/// <summary> /// Deprecated Method for adding a new object to the TblApplications EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToTblApplications(TblApplication tblApplication) { base.AddObject("TblApplications", tblApplication); }
/// <summary> /// Create a new TblApplication object. /// </summary> /// <param name="applicationId">Initial value of the ApplicationId property.</param> /// <param name="applicationName">Initial value of the ApplicationName property.</param> public static TblApplication CreateTblApplication(global::System.Int32 applicationId, global::System.String applicationName) { TblApplication tblApplication = new TblApplication(); tblApplication.ApplicationId = applicationId; tblApplication.ApplicationName = applicationName; return tblApplication; }
public ActionResult Save(ApplicationViewModel applicationViewModel) { try { if (ModelState.IsValid) { //add if (applicationViewModel.ApplicationId == 0 && applicationViewModel.ActionName == "Add") { var model = new TblApplication() { ApplicationId = applicationViewModel.ApplicationId, ApplicationName = applicationViewModel.ApplicationName, Description = applicationViewModel.Description, ApplicationTitle = applicationViewModel.ApplicationTitle, CompanyId = applicationViewModel.CompanyId }; _applicationRepository.Insert(model); } else if (applicationViewModel.ActionName == "Edit") //edit { TblApplication application = _applicationRepository.GetById(applicationViewModel.ApplicationId); if (application != null) { application.ApplicationId = applicationViewModel.ApplicationId; application.ApplicationName = applicationViewModel.ApplicationName; application.Description = applicationViewModel.Description; application.ApplicationTitle = applicationViewModel.ApplicationTitle; application.CompanyId = applicationViewModel.CompanyId; _applicationRepository.Update(application); } else { return Content(KendoUiHelper.GetKendoUiWindowAjaxSuccessMethod(Boolean.FalseString, applicationViewModel.ActionName, MessageType.warning.ToString(), ExceptionHelper.ExceptionMessageForNullObject())); } } _applicationRepository.Save(); return Content(KendoUiHelper.GetKendoUiWindowAjaxSuccessMethod(Boolean.TrueString, applicationViewModel.ActionName, MessageType.success.ToString(), "Saved Successfully.")); } return Content(KendoUiHelper.GetKendoUiWindowAjaxSuccessMethod(Boolean.FalseString, applicationViewModel.ActionName, MessageType.warning.ToString(), ExceptionHelper.ModelStateErrorFormat(ModelState))); } catch (Exception ex) { return Content(KendoUiHelper.GetKendoUiWindowAjaxSuccessMethod(Boolean.FalseString, applicationViewModel.ActionName, MessageType.warning.ToString(), ExceptionHelper.ExceptionMessageFormat(ex))); } }