コード例 #1
0
        public async Task <MSPPayPeriodViewModel> GetMSPPayPeriod(long Id)
        {
            try
            {
                tblMSPPayPeriod res = await Task.Run(() => ManageMSPPayPeriods.GetMSPPayPeriod(Id));

                return(res.ConvertToMSPPayPeriodViewModel());
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #2
0
        public async Task <MSPPayPeriodViewModel> UpdateMSPPayPeriod(MSPPayPeriodViewModel data)
        {
            try
            {
                tblMSPPayPeriod model = await Task.Run(() => ManageMSPPayPeriods.UpdateMSPPayPeriod(data.ConvertTotblMSPPayPeriod()));

                return(model.ConvertToMSPPayPeriodViewModel());
            }
            catch (Exception ex)
            {
                throw;
            }
        }
コード例 #3
0
 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
     });
 }
コード例 #4
0
        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;
            }
        }
コード例 #5
0
        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;
            }
        }
コード例 #6
0
        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;
            }
        }