public Resultado UpdatePeriodoPlanilla(PeriodoPlanilla periodoPlanilla) { MapperManager.GetInstance(); try { var periodoPlanillaDb = Mapper.Map <PeriodoPlanilla, PERIODOS_PLANILLAS>(periodoPlanilla); dbContext.Entry(periodoPlanillaDb).State = EntityState.Modified; dbContext.SaveChanges(); return(new Resultado("El PeriodoPlanilla se guardó correctamente.")); } catch (Exception excepcion) { LogHelper.RegisterError(excepcion.Message); return(new Resultado("Ocurrio un error. Favor contactarse con el administrador.")); } }
public Resultado InsertPeriodoPlanilla(PeriodoPlanilla periodoPlanilla) { MapperManager.GetInstance(); try { var periodoPlanillaDb = Mapper.Map <PeriodoPlanilla, PERIODOS_PLANILLAS>(periodoPlanilla); periodoPlanillaDb.UsuarioCreacion = "dbo"; periodoPlanillaDb.FechaCreacion = DateTime.Now; periodoPlanillaDb.UsuarioModificacion = "dbo"; periodoPlanillaDb.FechaModificacion = DateTime.Now; dbContext.PERIODOS_PLANILLAS.Add(periodoPlanillaDb); dbContext.SaveChanges(); periodoPlanilla.Id = periodoPlanillaDb.Id; return(new Resultado("El PeriodoPlanilla se guardó correctamente.")); } catch (Exception excepcion) { LogHelper.RegisterError(excepcion.Message); return(new Resultado("Ocurrio un error. Favor contactarse con el administrador.")); } }