public async Task <MSPPayPeriodViewModel> GetMSPPayPeriod(long Id) { try { tblMSPPayPeriod res = await Task.Run(() => ManageMSPPayPeriods.GetMSPPayPeriod(Id)); return(res.ConvertToMSPPayPeriodViewModel()); } catch (Exception) { throw; } }
public async Task <MSPPayPeriodViewModel> UpdateMSPPayPeriod(MSPPayPeriodViewModel data) { try { tblMSPPayPeriod model = await Task.Run(() => ManageMSPPayPeriods.UpdateMSPPayPeriod(data.ConvertTotblMSPPayPeriod())); return(model.ConvertToMSPPayPeriodViewModel()); } catch (Exception ex) { throw; } }
public static MSPPayPeriodViewModel ConvertToMSPPayPeriodViewModel(this tblMSPPayPeriod data) { return(new MSPPayPeriodViewModel() { ID = Convert.ToInt64(data.ID), StartDate = data.StartDate, EndDate = data.EndDate, isActive = data.IsActive, isDeleted = data.IsDeleted ?? false, createdUserID = data.CreatedUserID, updatedUserID = data.UpdatedUserID, createdTimestamp = data.CreatedTimestamp, updatedTimestamp = data.UpdatedTimestamp }); }
internal static async Task <tblMSPPayPeriod> UpdateMSPPayPeriod(tblMSPPayPeriod model) { try { using (db = new eMSPEntities()) { db.Entry(model).State = EntityState.Modified; int x = await Task.Run(() => db.SaveChangesAsync()); return(model); } } catch (Exception) { throw; } }
internal static async Task <tblMSPPayPeriod> InsertMSPPayPeriod(tblMSPPayPeriod data) { try { using (db = new eMSPEntities()) { db.tblMSPPayPeriods.Add(data); int x = await Task.Run(() => db.SaveChangesAsync()); return(data); } } catch (Exception ex) { throw; } }
internal static async Task DeleteMSPPayPeriod(long Id) { try { using (db = new eMSPEntities()) { tblMSPPayPeriod obj = await db.tblMSPPayPeriods.FindAsync(Id); db.tblMSPPayPeriods.Remove(obj); await Task.Run(() => db.SaveChangesAsync()); } } catch (Exception) { throw; } }