public bool AddEntries(Entries entries) { using (var ctx = new FoodCaloriesEntities()) { ctx.Entries.Add(entries); ctx.SaveChanges(); } return true; }
public EntriesBo Create(Entries entries) { if (entries != null) if (entries.Quantity != null) return new EntriesBo() { Url = _urlHelper.Link("DiariesEntries", new { entrieid = entries.IdEntry }), Description = entries.Description, Quantity = (int) entries.Quantity, DiariesBo = Create(entries.Diary), //FoodBo = Create(entries.Food) }; return null; }
public void UpdateEntrie(Entries entity,DateTime dairyid, int entrieid ) { using (var ctx = new FoodCaloriesEntities()) { var entrie = ctx.Entries.Include("Diary").FirstOrDefault(b=>b.IdEntry==entrieid && b.Diary.CurrentDate==dairyid); entrie.Quantity = entity.Quantity; ctx.SaveChanges(); } }
public Entries Parse(EntriesBo entries) { try { var entry = new Entries(); if (entries.Quantity != default(double)) { entry.Quantity = entries.Quantity; entry.Description = entries.Description; //entry.Diary = Parse(entries.DiariesBo); } return entry; } catch (Exception) { return null; } }