public IActionResult Save(BranchModel model) { try { if (!ModelState.IsValid) { return(RedirectToAction("Index")); } if (string.IsNullOrEmpty(model.BranchId)) { model.DateCreated = DateTime.UtcNow; _branchService.Create(model); } else { _branchService.Update(model); } return(RedirectToAction("Index")); } catch (Exception ex) { _logger.LogError(ex.Message + " " + ex.InnerException); } return(Content("Internal server error please contact the system administrator")); }
public IActionResult Create(BranchModel model) { if (ModelState.IsValid) { var entity = new Branch() { BranchName = model.BranchName }; _branchService.Create(entity); return(RedirectToAction("BranchList")); } return(View(model)); }
public ActionResult Create(BranchModel model) { try { var msg = new MessageModel(); model.CreatedBy = AccountIsAuthenticated(); model.ModifiedBy = AccountIsAuthenticated(); msg = _branchService.Create(model); ViewBag.message = Globals.ErrorMessage(msg.message, msg.result); return(View()); } catch (Exception ex) { ex.ToString(); } return(View()); }
public async Task <IActionResult> Create([FromBody] BranchModel model) { if (!ModelState.IsValid) { return(BadRequest(ModelState.GetErrorMessages())); } var branch = _mapper.Map <Branch>(model); int companyId = int.Parse(HttpContext.User.Claims.Where(c => c.Type == ClaimTypes.NameIdentifier).FirstOrDefault().Value); var result = await _branchService.Create(branch, companyId); if (!result.Success) { return(BadRequest(new { Success = false, Message = result.Message })); } var branchmodel = _mapper.Map <BranchModel>(result._branch); return(Ok(new { Success = true, result = branchmodel })); }
public ActionResult Create(Branch request) { _branchService.Create(request); _branchService.AssignDealers(request.Id, request.DealerIds); return(RedirectToAction(Request.Form["View"], EntityType.Branch.ToString())); }
public override StorePurchaseResponse Execute(StorePurchaseRequest request) { _branchService.Create(); return(_next.Execute(request)); }
public CreateResponse Post(BranchRequest request) { return(_branchService.Create(request)); }
public async Task Add(SqlBranch branch) { await _branchService.Create(branch); }
public async Task Add(BranchDTO branchDto) { var branch = _mapper.Map <Branch>(branchDto); await _branchService.Create(branch); }