//public StudentFixedScholarship SelectByIDs(int companyID) //{ // SmsMis.Models.Console.Handlers.Admin.SmsMisDB db = new SmsMis.Models.Console.Handlers.Admin.SmsMisDB(); // return db.Branch.ToList().Where(s => s.CompanyCode == companyID).ToList(); //} public void save(StudentFixedScholarship StudentFixedScholarship, string userId, bool isNew) { try { using (var context = new SmsMisDB()) { var entry = context.Entry(StudentFixedScholarship); if (entry != null) { StudentFixedScholarship.AddDateTime = DateTime.Now; StudentFixedScholarship.AddByUserId = userId; if (isNew) { entry.State = System.Data.Entity.EntityState.Added; } else { entry.State = System.Data.Entity.EntityState.Modified; } context.SaveChanges(); } } } catch (System.Data.Entity.Validation.DbEntityValidationException ex) { //throw ex; } catch (Exception ex) { // throw ex; } }
public ContentResult deleteStudentFixedScholarship(StudentFixedScholarship StudentFixedScholarship) { try { new hdlStudentFixedScholarship().delete(StudentFixedScholarship); } catch (Exception ex) { Response.StatusCode = 500; Content(JsonConvert.SerializeObject(new { error = ex.Message })); } return(getAllStudentFixedScholarship(StudentFixedScholarship.CompanyCode)); }
public ContentResult saveStudentFixedScholarship(StudentFixedScholarship StudentFixedScholarship, bool isNew) { try { new hdlStudentFixedScholarship().save(StudentFixedScholarship, Convert.ToString(Session["User"]), isNew); } catch (Exception ex) { Response.StatusCode = 500; Content(JsonConvert.SerializeObject(new { error = ex.Message })); } return(getAllStudentFixedScholarship(StudentFixedScholarship.CompanyCode)); }
public void delete(StudentFixedScholarship StudentFixedScholarship) { try { var context = new SmsMisDB(); context.StudentFixedScholarship.Attach(StudentFixedScholarship); var entry = context.Entry(StudentFixedScholarship); if (entry != null) { entry.State = System.Data.Entity.EntityState.Deleted; context.SaveChanges(); } } catch (System.Data.Entity.Validation.DbEntityValidationException ex) { //throw SmsMis.Models.Console.Common.ExceptionTranslater.translate(ex); throw ex; } catch (Exception ex) { //throw SmsMis.Models.Console.Common.ExceptionTranslater.translate(ex); throw ex; } }