public ActionResult CustomerDetailsFromLend(LendBookModel model) { if (model.SelectedCustomerId == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } return(CustomerDetails(model.SelectedCustomerId)); }
public ActionResult LendBook() { if (!ModelState.IsValid) { return(View("LendBook")); } var model = new LendBookModel(); model.Products = BusinessProduct.GetProducts(); model.Contacts = BusinessContact.GetContacts(); return(View("LendBook", model)); }
public ActionResult LendBook(LendBookModel e) { if (!ModelState.IsValid) { return(View("LendBook")); } BusinessProduct.LendBook(e.SelectedProductId, e.SelectedCustomerId); RouteValueDictionary routeValueDictionary = new RouteValueDictionary(); routeValueDictionary.Add("id", e.SelectedCustomerId); return(RedirectToAction("CustomerDetails", "Customer", routeValueDictionary)); }
public IActionResult Book(LendBookModel model) { if (model == null || string.IsNullOrEmpty(model.Id) || model.StartDate == null || model.EndDate == null) { return(BadRequest("Invalid data was provided.")); } var bookId = new ObjectId(model.Id); _lendService.LendBook(LoggedInUserId, bookId, model.StartDate.ToUniversalTime(), model.EndDate.ToUniversalTime()); return(Ok()); }