public string updateAccredApplication(CycleApplications application) { try { using (HotelManagementServerDataContext db = new HotelManagementServerDataContext()) { var query = from accredApp in db.CYCLE_APPLICATIONs where accredApp.HOTEL_ID.Equals(Convert.ToInt32(application.HotelId)) && accredApp.APPLICATION_ID.Equals(Convert.ToInt32(application.ApplicationId)) select accredApp; CYCLE_APPLICATION updatedApp = new CYCLE_APPLICATION(); updatedApp = query.Single(); updatedApp.APP_STATUS = application.ApplicationStatus; updatedApp.REASON = application.Reason; db.SubmitChanges(); return("Success Update Successful"); } } catch (Exception) { return("Failed Update Failed"); } }
public int applyForAccred(CycleApplications application) { try { using (HotelManagementServerDataContext db = new HotelManagementServerDataContext()) { CYCLE_APPLICATION applicationToInsert = ConvertToLinq.ConvertAccredApplyToLinq(application); db.CYCLE_APPLICATIONs.InsertOnSubmit(applicationToInsert); db.SubmitChanges(); return(applicationToInsert.APPLICATION_ID); } } catch (Exception) { return(-1); } }