public IActionResult Create() { var isLogin = HttpContext.Session.GetString("isUserLogin"); if (isLogin == "true") { var model = new DeliveryAddModel(); model.BranchList = _branchService.GetAll(); model.ProductList = _productService.GetAll(); return View(model); } return RedirectToAction("Login", "Home"); }
public async Task <ServiceResult> Add([FromBody] DeliveryAddModel apiEntity) { var entity = DeliveryAddModel.Map(apiEntity); var result = await _contentGroupService.AddAsync(entity); if (result.TryCastModel(out ContentGroup contentGroup)) { result.ViewModel = DeliveryViewModel.Map(contentGroup); } return(result); }