// POST: api/Courts public IHttpActionResult Post([FromBody] Court c) { c.UserId = "b05c5fcc-f7cf-4111-a77b-cdea8c56cf7b"; int result = CourtRepository.InsertCourt(c); return(Ok(result)); }
public ActionResult Create([Bind(Include = "Id,Name")] Court court) { userID = User.Identity.GetUserId(); if (ModelState.IsValid) { CourtRepository.InsertCourt(userID, court.Name); return(RedirectToAction("Index")); } return(View(court)); }
public ActionResult Create(CreateCaseViewModel vm) { userID = User.Identity.GetUserId(); if (db.Cases.Any(x => x.Aa == vm.Aa && x.UserId == userID) || !ModelState.IsValid) { vm.PrepareLists(userID); return(View(vm)); } if (vm.newAttorney) { vm.AttorneyId = AttorneyRepository.InsertAttorney(userID, vm); } if (vm.newCourt) { vm.CourtId = CourtRepository.InsertCourt(userID, vm); } if (vm.newProsecution) { vm.ProsecutionId = PartyRepository.InsertPartyProsecution(userID, vm); } if (vm.newDefense) { vm.DefenseId = PartyRepository.InsertPartyDefense(userID, vm); } if (vm.newRecipient) { vm.RecipientId = PartyRepository.InsertPartyRecipient(userID, vm); } CaseRepository.InsertCaseFromViewModel(userID, vm); return(RedirectToAction("Index")); }