public async Task <IActionResult> AssetEditComment(int ACommentID) { var model = new AssetCommentModel(); if (ACommentID == 0) { return(RedirectToAction("AssetEditC")); } var comment = await _assetService.GetAssetCommentById(ACommentID); model = _mapper.Map <AssetCommentModel>(comment); return(View(model)); }
public async Task <IActionResult> AssetAddComment(int AssetID) { var model = new AssetCommentModel(); var asset = await _assetService.GetAsset(AssetID); if (asset == null) { return(RedirectToAction("AssetList")); } model.AssetId = AssetID; return(View(model)); }
public async Task <IActionResult> AssetEditComment(AssetCommentModel model) { if (ModelState.IsValid) { var commenttObj = _mapper.Map <AssetComment>(model); var result = await _assetService.UpdateCommentAsset(commenttObj); if (result) { SuccessNotification("The asset comment data has been updated successfully."); return(RedirectToAction("AssetEditComment", "AssetManagement", new { ACommentID = model.AcommentId })); } else { ModelState.AddModelError("", "Something went wrong while editing record"); } } return(View(model)); }
public async Task <IActionResult> AssetAddComment(AssetCommentModel model) { if (ModelState.IsValid) { model.Adate = DateTime.Now; var commentObj = _mapper.Map <AssetComment>(model); var result = await _assetService.InsertCommentAsset(commentObj); if (result) { SuccessNotification("The asset comment data has been saved successfully."); } else { ModelState.AddModelError("", "Something went wrong while saving record"); } } return(View(model)); }