public JsonResult Editar(string descripcion, string catalogoId, string itemId) { string result = "duplicate"; switch (catalogoId) { case "m": if (!cliente.GetStates().Any(m => m.Name.ToLower() == descripcion.ToLower())) { StateDTO state = new StateDTO(); state.Name = descripcion; state.Id = Int32.Parse(itemId); cliente.UpdateState(state); result = "success"; } break; case "p": if (!cliente.GetMonths().Any(m => m.Description.ToLower() == descripcion.ToLower())) { MonthDTO month = new MonthDTO(); month.Description = descripcion; month.Id = Int32.Parse(itemId); cliente.UpdateMonth(month); result = "success"; } break; case "n": if (!cliente.GetStatus().Any(m => m.Description.ToLower() == descripcion.ToLower())) { StatusDTO status = new StatusDTO(); status.Description = descripcion; status.Id = Int32.Parse(itemId); cliente.UpdateStatus(status); result = "success"; } break; case "c": if (!cliente.GetYears().Any(m => m.Description.ToLower() == descripcion.ToLower())) { YearDTO year = new YearDTO(); year.Description = descripcion; year.Id = Int32.Parse(itemId); cliente.UpdateYear(year); result = "success"; } break; } return(new JsonResult { Data = new { Result = result } }); }
public void UpdateMonth(MonthDTO dto) { var b = new ParamDAO(); if (dto.Id > 0) { b.UpdateMonth(dto, true); } else { b.UpdateMonth(dto, false); } }
public void UpdateMonth(MonthDTO month, bool editar) { using (SEDESOLEntities entities = new SEDESOLEntities()) { if (editar) { MONTH existente = entities.MONTHs.FirstOrDefault(v => v.Id == month.Id); if (existente != null) { existente.Description = month.Description; entities.SaveChanges(); } } else { MONTH nueva = new MONTH(); nueva.Description = month.Description; nueva.IsActive = true; entities.MONTHs.Add(nueva); entities.SaveChanges(); } } }
public void UpdateMonth(MonthDTO dto) { ParamDAL dal = new ParamDAL(); dal.UpdateMonth(dto); }