Esempio n. 1
0
        public IActionResult Create(ConcernViewModel newConcern)
        {
            if (ModelState.IsValid)
            {
                var concernToCreate = new Concern()
                {
                    ConcernId = Guid.NewGuid(),
                    // EmployeeId = newConcern.EmployeeId,
                    // Guid.NewGuid(),
                    // newConcern.EmployeeId,
                    ConcernDate = DateTime.Now,
                    // newConcern.ConcernDate,
                    ConcernType    = newConcern.ConcernType,
                    ConcernRemarks = newConcern.ConcernRemarks,
                    ConcernStatus  = newConcern.ConcernStatus
                };
                _employee.AddNewConcern(concernToCreate);

                return(RedirectToAction("Index"));
            }
            else
            {
                return(View("Form", newConcern));
            }
        }
Esempio n. 2
0
        public IActionResult Edit(Guid id)
        {
            // Get the concern from the EmployeeManagement
            var concern = _employee.GetByConcernId(id);

            // build the view model
            var concernViewModel = new ConcernViewModel()
            {
                // ConcernDate = concern.ConcernDate,
                ConcernType    = concern.ConcernType,
                ConcernRemarks = concern.ConcernRemarks,
                ConcernStatus  = concern.ConcernStatus,
                ConcernId      = id
            };

            // send the view model
            ViewBag.IsEditing = true;
            return(View("Form", concernViewModel));
        }
Esempio n. 3
0
        // GET: Concerns/Details/5
        public async Task <IActionResult> Details(Guid id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var item = await _context.LookupConcerns.AsNoTracking()
                       .Where(m => m.Id == id)
                       .SingleOrDefaultAsync();

            if (item == null)
            {
                return(NotFound());
            }

            var model = new ConcernViewModel(item);

            return(View(model));
        }
Esempio n. 4
0
 public IActionResult Update(ConcernViewModel updatedConcern)
 {
     if (ModelState.IsValid)
     {
         var concernToUpdate = new Concern()
         {
             ConcernId      = updatedConcern.ConcernId.Value,
             ConcernDate    = DateTime.Now,
             ConcernType    = updatedConcern.ConcernType,
             ConcernRemarks = updatedConcern.ConcernRemarks,
             ConcernStatus  = updatedConcern.ConcernStatus
         };
         _employee.UpdateConcern(concernToUpdate);
         return(RedirectToAction("Index"));
     }
     else
     {
         ViewBag.IsEditing = true;
         return(View("Form", updatedConcern));
     }
 }