public IActionResult CreateFamily(Family family) { if (!ModelState.IsValid) { return(View()); } _familyService.AddFamily(family); return(RedirectToAction("Families")); }
public async Task AddFamily([FromBody] Family family) { try { familyService.AddFamily(family); } catch (Exception e) { Console.WriteLine(e); StatusCode(500, e.Message); } }
public async Task <ActionResult <Family> > AddFamily([FromBody] Family family) { try { familyService.AddFamily(family); return(Ok(family)); } catch (Exception e) { Console.WriteLine(e); return(StatusCode(500, e.Message)); } }
public ActionResult Add(int curPage) { if (Request.Form != null && Request.Form.Count > 0) { resp = familyService.AddFamily(Request); return(this.JudgeResult(resp, () => RedirectToAction("Details", new { curpage = curPage, msg = string.Format("添加了成员{0} {1}", Request.Form["userid"], Request.Form["username"]) }))); } conta_List_Status = new Container_List_Status(); userService = ServiceBuilder.BuildUserService(); conta_List_Status.list_Col = userService.GetAllCollage(); conta_List_Status.list_Grd = userService.GetAllGrd(); conta_List_Status.list_Dep = userService.GetAllDep(); conta_List_Status.curpage = curPage; return(View(conta_List_Status)); }
public async Task <ActionResult <Family> > AddFamily([FromBody] Family family) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { await familyService.AddFamily(family); return(Created($"/{family.StreetName}&{family.HouseNumber}", family)); } catch (Exception e) { Console.WriteLine(e); return(StatusCode(500, e.Message)); } }
public async Task <IActionResult> AddFamily(AddFamilyDto newFamily) { return(Ok(await _familyService.AddFamily(newFamily))); }
public async Task <ItemResponse <Family> > Post([FromBody] Family family) { return(await _familyService.AddFamily(family)); }