public OtherConsumption Insert(OtherConsumption item) { var inserted = OtherConsumptions.Add(item); _ctx.SaveChanges(); return(inserted); }
public void Update(OtherConsumption item) { var updated = OtherConsumptions.FirstOrDefault(x => x.UniqueId == item.UniqueId); updated.Name = item.Name; updated.CalculationType = item.CalculationType; updated.Date = item.Date; updated.Price = item.Price; updated.MansionId = item.MansionId; _ctx.SaveChanges(); }
public static OtherConsumptionViewModel ToViewModel(this OtherConsumption item) { Enums.CalculationType calculationType; Enum.TryParse(item.CalculationType.ToString(), out calculationType); return(new OtherConsumptionViewModel { CalculationType = calculationType, Name = item.Name, Id = item.UniqueId, Date = item.Date.Value.ToString("MM/dd/yyyy"), MansionId = item.Mansion.UniqueId, MansionName = item.Mansion.Address, Price = item.Price }); }
public void Update(OtherConsumption item) { _repository.Update(item); }
public OtherConsumption Insert(OtherConsumption item) { return(_repository.Insert(item)); }