public int Add(clockrecord cc) { using (var ctx = new oneallEntities()) { ctx.clockrecord.Add(cc); return(ctx.SaveChanges()); } }
public ActionResult Add(string des, string loc) { var date = DateTime.Now; ClokerRecordService c = new ClokerRecordService(); clockrecord cc = new clockrecord() { createat = date, location = loc, describe = des, type = date.Hour > 12 ? 1 : 2 }; return(Content(JsonConvert.SerializeObject(c.Add(cc)))); }