public UpdateBillingCycleViewModel GetBillingCycleForUpdateById(byte BCRowID) { try { UpdateBillingCycleViewModel model = new UpdateBillingCycleViewModel(); var entity = db.MasterBillingCycles.Find(BCRowID); if (entity != null) { model.BillingRowID = entity.BillingRowID; model.BillingCycle = entity.BillingCycle; model.Status = entity.Status; } else { throw new Exception("Invalid Id!"); } return(model); } catch (Exception) { throw; } }
public void UpdateBillingCycle(UpdateBillingCycleViewModel model) { try { if (model != null && model.BillingCycle.Length > 0) { db.MasterBillingCycles.Single(b => b.BillingRowID == model.BillingRowID).BillingCycle = model.BillingCycle; } else { throw new Exception("Billing cycle could not be blank!"); } } catch (Exception) { throw; } }