Exemplo n.º 1
0
        //TEST
        public bool UpdateBTCompletedBy(BTEdit model)
        {
            using (var ctx = new ApplicationDbContext())
            {
                BulkTechSamples entity = ctx.BulkTechSamples.SingleOrDefault(e => e.BTId == model.BTId);
                //entity.DueOnDate = model.DueOnDate;
                entity.CompletedOnDate = DateTime.Now;
                entity.IsComplete      = true;
                entity.EmployeeId      = model.EmployeeId;

                return(ctx.SaveChanges() == 1);
            }
        }
Exemplo n.º 2
0
        //GET: BulkTech/Edit/{id}
        public ActionResult Edit(int id)
        {
            BTDetail detail = service.GetBTById(id);
            BTEdit   model  = new BTEdit
            {
                BTId       = detail.BTId,
                IsComplete = detail.IsComplete,
                DueOnDate  = detail.DueOnDate,
                //CompletedOnDate = detail.CompletedOnDate
                //Should I add employee here?
            };

            return(View(model));
        }
Exemplo n.º 3
0
        public ActionResult Edit(int id, BTEdit model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            if (model.BTId != id)
            {
                ModelState.AddModelError("", "ID does not match.");
                return(View(model));
            }
            if (service.UpdateBT(model))
            {
                TempData["SaveBTResult"] = $"Bulk/Tech Sample {service.GetBTById(id).DueOnDate.ToLongDateString()} was updated.";
                return(RedirectToAction("Index"));
            }

            ModelState.AddModelError("", "Bulk/Tech Sample date could not be updated.");
            return(View());
        }