public ActionResult Edit(Models.FineModel model) { fine.UpdateData(model); var dataList = fine.DisplayData(); return(View("Index", dataList)); }
public ActionResult AddData(Models.FineModel authorModel) { fine.SaveData(authorModel); var data = fine.DisplayData(); return(View("Index", data)); }
public void SaveData(Models.FineModel fineModel) { var data = new Fine() { FineID = fineModel.FineID, LateDays = fineModel.LateDays, StaffMemberID = fineModel.StaffMemberID, Amount = fineModel.Amount, Remarks = fineModel.Remarks, }; context.Fines.Add(data); context.SaveChanges(); }
public void UpdateData(Models.FineModel model) { try { Fine data = new Fine(); data = context.Fines. Where(a => a.FineID == model.FineID).FirstOrDefault(); data.LateDays = model.LateDays; data.StaffMemberID = model.StaffMemberID; data.Amount = model.Amount; data.Remarks = model.Remarks; context.SaveChanges(); } catch (Exception) { throw; } }