Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        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));
        }
Ejemplo n.º 3
0
        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));
        }
Ejemplo n.º 4
0
        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));
        }