public bool CreateChurch(ChurchCreate model) { Church church = new Church() { ChurchName = model.ChurchName, ChurchCity = model.ChurchCity, ChurchState = model.ChurchState }; using (var ctx = new ApplicationDbContext()) { ctx.Churches.Add(church); return(ctx.SaveChanges() == 1); } }
public IHttpActionResult Post(ChurchCreate church) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var service = new ChurchService(); if (!service.CreateChurch(church)) { return(InternalServerError()); } return(Ok()); }