//返回添加的记录id public static int AddApplyRecord(Apply_record record) { using (var context = new DataModels()) { context.Apply_record.Add(record); context.SaveChanges(); return(record.id); } }
public static string ChangeApplyRecordStatus(int recordId, int status, string replyMsg = "") { using (var context = new DataModels()) { Apply_record edit_record = context.Apply_record.Find(recordId); DateTime currentTime = DateTime.Now; edit_record.finish_time = currentTime.ToString("yyyy/M/d HH:MM:ss"); edit_record.status = status; edit_record.reply_msg = replyMsg; context.SaveChanges(); return("success"); } }
public static string ChangeApplyUseTime(int recordId, string dueTime) { using (var context = new DataModels()) { Apply_record edit_record = context.Apply_record.Find(recordId); if (edit_record == null) { throw new Exception("record not found"); } edit_record.due_time = dueTime; if (context.SaveChanges() > 0) { return("success"); } throw new Exception("error"); } }