private async Task <BorrowCommonViewModel> GetBorrowCommonModelAsync(int?id) { BorrowCommonViewModel common = new BorrowCommonViewModel(); common.Borrow = await this.GetBorrowModelAsync(id); return(common); }
public async Task <IActionResult> Edit(int id, [Bind] BorrowCommonViewModel common) { if (id != common.Borrow.BorrowId) { return(NotFound()); } if (ModelState.IsValid) { await this._borrowService.ChangeDuration(common.Borrow.BorrowId, common.Borrow.Start, common.Borrow.End); return(RedirectToAction(nameof(Index))); } return(View(common.Borrow)); }
public async Task <IActionResult> Score(int id, [Bind] BorrowCommonViewModel common) { if (id != common.Borrow.BorrowId) { return(NotFound()); } if (ModelState.IsValid) { await this._borrowService.SetScore(common.Borrow.BorrowId, User, common.Borrow.Score); return(RedirectToAction(nameof(Index))); } return(View(common.Borrow)); }
public async Task <IActionResult> Create([Bind] BorrowCommonViewModel common) { if (ModelState.IsValid) { await this._borrowService.Create(User, common.Borrow); return(RedirectToAction(nameof(Index))); } else { ViewData["idProduct"] = common.Borrow.ProductId; ViewData["productStart"] = common.Borrow.ProductStart; ViewData["productEnd"] = common.Borrow.ProductEnd; } return(View(common.Borrow)); }
public async Task <IActionResult> AddComment(int id, [Bind] BorrowCommonViewModel common) { if (id != common.Borrow.BorrowId) { return(NotFound()); } if (ModelState.IsValid) { await this._borrowService.AddComment(common.Borrow.BorrowId, common.Comment.Text, User); common = await this.GetBorrowCommonModelAsync(id); return(View(common)); } return(View(common)); }