public IActionResult Edit(vmBranchHead modelData) { //var headObj = db.BranchHead.Get(modelData.Id); if (ModelState.IsValid) { BranchHead head = db.BranchHead.GetFirstOrDefault(c => c.Id == modelData.Id); head.CompanyId = modelData.CompanyId; head.EmployeeId = modelData.EmployeeId; head.BranchId = modelData.BranchId; head.DivisionId = modelData.DivisionId; head.SisterConcernId = modelData.SisterConcernId; db.BranchHead.Update(head); db.Save(); if (head.Id > 0) { return(Json(true)); } } return(Json(false)); }
public IActionResult Create(vmBranchHead vmBranchHead) { if (!ModelState.IsValid) { BranchHead branchHead = new BranchHead() { CompanyId = vmBranchHead.CompanyId, SisterConcernId = vmBranchHead.SisterConcernId, EmployeeId = vmBranchHead.EmployeeId, BranchId = vmBranchHead.BranchId, DivisionId = vmBranchHead.DivisionId }; db.BranchHead.Add(branchHead); db.Save(); ModelState.Clear(); if (branchHead.Id > 0) { return(Json(true)); } } return(Json(false)); }
public IActionResult CreateView() { vmBranchHead vmBranch = new vmBranchHead(); return(PartialView("BHeadCreate", vmBranch)); }