public string Create(Attendance attendance) { try { dbContext.Attendances.Add(attendance); dbContext.SaveChanges(); return Constants.AJAX_CREATE_SUCCESS_RETURN; } catch (Exception e1) { return "<p class='alert alert-danger'>出错了: " + e1.Message + "</p>"; } }
public string Edit(Attendance attendance) { try { dbContext.Entry(attendance).State = System.Data.Entity.EntityState.Modified; dbContext.SaveChanges(); return Constants.AJAX_EDIT_SUCCESS_RETURN; } catch (Exception e1) { return "<p class='alert alert-danger'>出错了: " + e1.Message + "</p>"; } }