public Task <string> Delete(int id) { try { RichmonddayInfo info = _db.RichmonddayInfoes.Where(r => r.Id == id).FirstOrDefault(); _db.RichmonddayInfoes.Remove(info); _db.SaveChanges(); return(Task.FromResult(Output.Deleted.ToString())); } catch (Exception ex) { ErrorLog.GetDefault(null).Log(new Error(ex)); throw; } }
public Task <int> Save(RichmonddayInfoModel data) { try { RichmonddayInfo info = new RichmonddayInfo { FirstName = data.FirstName, LastName = data.LastName, Email = data.Email }; _db.RichmonddayInfoes.Add(info); _db.SaveChanges(); return(Task.FromResult(info.Id)); } catch (Exception ex) { ErrorLog.GetDefault(null).Log(new Error(ex)); return(Task.FromResult(0)); } }