示例#1
0
 public static void CheckMobileBusinessFkExists(ReVyvvDataContext context, int id)
 {
     if (context.Product.FirstOrDefault(x => x.ProductId == id) == null)
     {
         throw new Exception($"Product with MobileBusinessFk id '{id}' already exists.");
     }
 }
示例#2
0
 public static void CheckPersonIdExists(ReVyvvDataContext context, int id)
 {
     if (context.Person.FirstOrDefault(x => x.PersonId == id) == null)
     {
         throw new Exception($"Person id '{id}' doesn't exist.");
     }
 }
示例#3
0
 public static void CheckBusinessIdExists(ReVyvvDataContext context, int id)
 {
     if (context.MobileBusiness.FirstOrDefault(x => x.MobileBusinessId == id) == null)
     {
         throw new Exception($"Business id {id} doesn't exist.");
     }
 }
示例#4
0
        //public static void CheckActorType(MobileBusinessCreateDto business)
        //{
        //    //make sure actor type is valid
        //    //todo: create a validation class
        //    if (!typeof(ActorType).GetAllDescriptions<ActorType>().Contains(business.ActorType))
        //    {
        //        throw new ArgumentOutOfRangeException(nameof(business.ActorType));
        //    }
        //}

        public static void CheckUserIdExists(ReVyvvDataContext context, int id)
        {
            if (context.PersonAsUser.FirstOrDefault(x => x.PersonAsUserId == id) != null)
            {
                throw new Exception($"Person id '{id}' already exists.");
            }
        }
示例#5
0
        //public static void CheckMonthlyVolumeBracketIdExists(ReVyvvDataContext context, int id)
        //{
        //    if (context.PlatformMobileBusinessMonthlyVolumeBracket.FirstOrDefault(x => x.PlatformMobileBusinessMonthlyVolumeBracketId == id) == null)
        //    {
        //        throw new Exception($"Monthly Volume Bracket id {id} doesn't exist.");
        //    }
        //}

        public static void CheckOrganizationNameExists(ReVyvvDataContext context, string organizationName)
        {
            if (string.IsNullOrEmpty(organizationName))
            {
                return;
            }

            //check if name exists
            //make sure business name doesn't exist already.
            if (context.MobileBusiness.FirstOrDefault(x => x.MobileBusinessNavigation.OrganizationName.Equals(organizationName)) != null)
            {
                throw new Ex_O_02($"Business Name '{organizationName}' already exists.");
            }
        }
 public AuthRepository(ReVyvvDataContext context, IMapper mapper, IConfiguration configuration)
 {
     this.context       = context;
     this.mapper        = mapper;
     this.configuration = configuration;
 }