public static Festivos ModifyFestivo(Festivos festivo) { if (IsFestivo(festivo.Festivo_Fecha)) { var record = GetFestivo(festivo.Festivo_Fecha); record.Festivo_Descripcion = festivo.Festivo_Descripcion; db.SubmitChanges(); return(record); } else { throw new Exception($"El festivo {festivo.Festivo_Fecha.ToString("dd-mm-yyyy")} no existe en la base de datos."); } }
public static Festivos NewFestivo(Festivos festivo) { if (!IsFestivo(festivo.Festivo_Fecha)) { var newRecord = new Festivos() { Festivo_Fecha = festivo.Festivo_Fecha, Festivo_Descripcion = festivo.Festivo_Descripcion }; db.Festivos.InsertOnSubmit(newRecord); db.SubmitChanges(); return(newRecord); } else { throw new Exception($"El festivo {festivo.Festivo_Fecha.ToString("dd-MM-yyyy")} ya está dado de alta en la base de datos"); } }
public Festivos NuevoFestivo(Festivos festivo) { return(Managers.ClsFestivos.NewFestivo(festivo)); }
public Festivos EditarFestivo(Festivos festivo) { return(Managers.ClsFestivos.ModifyFestivo(festivo)); }