Ejemplo n.º 1
0
        public ActionResult SaveMaintenanceAssn(MaintenanceAssignment data)
        {
            data.UserId   = (int)Session["UserId"];
            data.BranchId = 1;
            data.AddedOn  = DateTime.Now;
            data.Status   = false;


            db.MaintenanceAssignments.Add(data);
            if (db.SaveChanges() > 0)
            {
                var pa = db.MaintenanceRequests.FirstOrDefault(e => e.ComplainName.Equals(data.RequsetedTask));

                if (pa == null)
                {
                    return(RedirectToAction("MaintenanceIndex", new { }));
                }

                pa.Assigned = true;



                db.SaveChanges();
            }


            return(RedirectToAction("MaintenanceIndex", new { }));
        }
Ejemplo n.º 2
0
        public ActionResult ConfirmMaintenace(int?id)
        {
            // id = db.AmbulanceMasters.Where(e => e.Engaged == false);
            MaintenanceAssignment obj = db.MaintenanceAssignments.Find(id);

            if (obj != null)
            {
                obj.Status = true;
                UpdateModel(obj);

                if (db.SaveChanges() > 0)
                {
                    var pa = db.MaintenanceRequests.FirstOrDefault(e => e.ComplainName.Equals(obj.RequsetedTask));

                    if (pa == null)
                    {
                        return(RedirectToAction("MaintenanceIndex", new { }));
                    }

                    pa.Status = true;



                    db.SaveChanges();
                }
            }

            else
            {
                return(Content("Not such an object"));
            }
            return(Content("Request Approved"));
        }