예제 #1
0
        public IActionResult UpdateRecord(int Id, bool isApproved, string viewName)
        {
            Record updatedRecord = TopRecordsList.FirstOrDefault(x => x.ID == Id);

            updatedRecord.Approved = isApproved;

            if (!isApproved)
            {
                var confirmURL = $"{this.Request.Scheme}://{this.Request.Host}{this.Request.PathBase}/{this.ControllerContext.RouteData.Values["controller"]}/Validation?IsApproved=false&recordID=" + Id;
                _topRecordsRepository.ConfirmationURL(confirmURL, updatedRecord, viewName);
            }
            else
            {
                TopRecordsList = _topRecordsRepository.UpdateRecord(updatedRecord);
            }

            return(RedirectToAction(viewName, "Home"));
        }