public static MSPSpendCategoryViewModel ConvertToMSPSpendCategoryViewModel(this tblMSPSpendCategory data) { return(new MSPSpendCategoryViewModel() { ID = Convert.ToInt64(data.ID), Name = data.Name, Description = data.Description, isActive = data.IsActive, isDeleted = data.IsDeleted ?? false, createdUserID = data.CreatedUserID, updatedUserID = data.UpdatedUserID, createdTimestamp = data.CreatedTimestamp, updatedTimestamp = data.UpdatedTimestamp }); }
internal static async Task <tblMSPSpendCategory> UpdateMSPSpendCategory(tblMSPSpendCategory 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 <tblMSPSpendCategory> InsertMSPSpendCategory(tblMSPSpendCategory data) { try { using (db = new eMSPEntities()) { db.tblMSPSpendCategories.Add(data); int x = await Task.Run(() => db.SaveChangesAsync()); return(data); } } catch (Exception ex) { throw; } }
internal static async Task DeleteMSPMSPSpendCategory(long Id) { try { using (db = new eMSPEntities()) { tblMSPSpendCategory obj = await db.tblMSPSpendCategories.FindAsync(Id); db.tblMSPSpendCategories.Remove(obj); await Task.Run(() => db.SaveChangesAsync()); } } catch (Exception) { throw; } }