Forum-Inzynieria1/Trunk/Server/Forum/MailSender/Models/MailModel.cs

35 lines
1.2 KiB
C#
Raw Normal View History

2018-12-08 19:27:21 +01:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace MailSender.Models
{
[Table("Mail")]
public class MailModel
{
[Key]
public int Id { get; set; }
2018-12-08 19:27:21 +01:00
//[ForeignKey]
//public int UserId //id usera ktory wyslal maila
2018-12-08 19:27:21 +01:00
[Display(Name = "Subject")]
[Required(AllowEmptyStrings = false)]
2018-12-08 19:27:21 +01:00
public string Subject { get; set; }
[DataType(DataType.EmailAddress)]
[Required(AllowEmptyStrings = false, ErrorMessage = "You need to type in an e-mail")]
[RegularExpression(".*@.*\\..*", ErrorMessage = "You typed in e-mail in wrong format")]
2018-12-08 19:27:21 +01:00
[Display(Name = "E-Mail to")]
public string EMailTo { get; set; }
2018-12-08 19:27:21 +01:00
[Required(AllowEmptyStrings = false, ErrorMessage = "You need to type in a message to send")]
[DataType(DataType.Text)]
[StringLength(500, ErrorMessage = "Message has to have between 1 and 500 chars", MinimumLength = 1)]
2018-12-08 19:27:21 +01:00
public string Content { get; set; }
}
}