Example #1
0
        public async Task <bool> Update(string id, Contexts.Schools model)
        {
            var result = false;

            try
            {
                var user = dbContext.Schools.FirstOrDefault(x => x.Id == id);
                if (user != null)
                {
                    user.City_Id      = model.City_Id;
                    user.District_Id  = model.District_Id;
                    user.Phone_Number = model.Phone_Number;
                    user.Address      = model.Address;
                    user.SchoolType   = model.SchoolType;
                    user.Name         = model.Name;
                    await dbContext.SaveChangesAsync();

                    result = true;
                }
            }
            catch (Exception ex)
            {
            }
            return(result);
        }
Example #2
0
 private Contexts.Schools FindById(string id)
 {
     Contexts.Schools result = null;
     try
     {
         result = dbContext.Schools.FirstOrDefault(x => x.Id == id);
     }
     catch (Exception)
     {
     }
     return(result);
 }
Example #3
0
        public async Task <bool> Add(Contexts.Schools model)
        {
            var result = false;

            try
            {
                dbContext.Schools.Add(model);
                await dbContext.SaveChangesAsync();

                result = true;
            }
            catch (Exception)
            {
            }
            return(result);
        }