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); }
private Contexts.Schools FindById(string id) { Contexts.Schools result = null; try { result = dbContext.Schools.FirstOrDefault(x => x.Id == id); } catch (Exception) { } return(result); }
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); }