// GET: Agent_GroupHorary/Edit/5
        public ActionResult Edit(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Agent_GroupHorary agent_GroupHorary = db.Agent_GroupHorary.Find(id);

            if (agent_GroupHorary == null)
            {
                return(HttpNotFound());
            }
            return(View(agent_GroupHorary));
        }
 public ActionResult DeleteConfirmed(Guid id)
 {
     if (db.Agent_GroupHoraryDetail.Where(g => g.Id_GroupHorary == id) != null)
     {
         Agent_GroupHorary agent_GroupHorary = db.Agent_GroupHorary.Find(id);
         db.Agent_GroupHorary.Remove(agent_GroupHorary);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     else
     {
         Warning("Grupo de horario tiene detalle de horarios", string.Empty);
     }
     return(View());
 }
 public ActionResult Edit([Bind(Include = "Id_GroupHorary,NameGroup")] Agent_GroupHorary agent_GroupHorary)
 {
     if (ModelState.IsValid)
     {
         if (db.Agent_GroupHorary.Where(d => d.NameGroup == agent_GroupHorary.NameGroup).ToList().Count == 0)
         {
             db.Entry(agent_GroupHorary).State = EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         else
         {
             Warning("Grupo de horario ya existe", string.Empty);
         }
     }
     return(View(agent_GroupHorary));
 }
        public ActionResult Create([Bind(Include = "Id_GroupHorary,NameGroup")] Agent_GroupHorary agent_GroupHorary)
        {
            if (ModelState.IsValid)
            {
                if (db.Agent_GroupHorary.Where(d => d.NameGroup == agent_GroupHorary.NameGroup).ToList().Count == 0)
                {
                    agent_GroupHorary.Id_GroupHorary = Guid.NewGuid();
                    db.Agent_GroupHorary.Add(agent_GroupHorary);
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
                else
                {
                    Warning("Grupo de horario ya existe", string.Empty);
                }
            }

            return(View(agent_GroupHorary));
        }