Source

main-vinayFork / Source / WebService / Web.Admin / ViewModel / RepositoryViewModel.cs

Full commit
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web.Mvc;
using DataUp.Web.Admin.DataLayer;

namespace DataUp.Web.Admin.ViewModel
{
    public class RepositoryViewModel
    {
        public RepositoryViewModel()
        {
            this.RepositoryTypes = new SelectList(Enumerable.Empty<RepositoryType>());
        }

        public int RepositoryId { get; set; }

        [Required(AllowEmptyStrings = false, ErrorMessage = "Repository Name is required")]
        [RegularExpression(@"^[a-zA-Z0-9.+-_' ']*$", ErrorMessage = "Invalid Repository Name")]
        [Display(Name = "Repository Name")]
        [DataType(DataType.Text)]
        public string RepositoryName { get; set; }

        public string RepositoryType { get; set; }

        [Required(AllowEmptyStrings = false, ErrorMessage = "Identifier Url is Required")]
        [RegularExpression(@"(http|https)://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?", ErrorMessage = " Kindly specify Url format like https://www.somesite.com or http://www.somesite.com")]
        [Display(Name = "Get Identifier URL")]
        [DataType(DataType.Text)]
        public string IdentifierUrl { get; set; }

        [Required(AllowEmptyStrings = false, ErrorMessage = "Post File Url is Required")]
        [Display(Name = "Post File URL")]
        [DataType(DataType.Text)]
        [RegularExpression(@"(http|https)://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?")]
        public string PostFileUrl { get; set; }

        [Required(AllowEmptyStrings = false, ErrorMessage = "User Agreement is Required")]
        [Display(Name = "User Agreement")]
        [DataType(DataType.Text)]
        public string UserAgreement { get; set; }

        [Required(AllowEmptyStrings = false, ErrorMessage = "User name is Required")]
        [Display(Name = "User Name")]
        [DataType(DataType.Text)]
        public string UserName { get; set; }

        [Required(AllowEmptyStrings = false, ErrorMessage = "Password is Required")]
        [Display(Name = "Password")]
        [DataType(DataType.Text)]
        public string Password { get; set; }

        public SelectList RepositoryTypes { get; set; }

        [Required(AllowEmptyStrings = false, ErrorMessage = "Please select Repository Type")]
        [Display(Name = "Repository Type")]
        [DataType(DataType.Text)]
        public string SelectedRepositoryTypeId { get; set; }

        public bool PasswordRequired { get; set; }

        public string CreatedBy { get; set; }
    }
}