//Skapar en ny film i databasen public void InsertMovie(Movie movie, Role role) { ICollection <ValidationResult> validationResults; if (!movie.Validate(out validationResults) && !role.Validate(out validationResults)) { var ex = new ValidationException("The object did not pass the validation."); ex.Data.Add("ValidationResult", validationResults); throw ex; } MovieDAL.InsertMovie(movie, role); }
//Skapar en ny roll i databasen eller uppdaterar en befintlig public void SaveRole(Role role) { ICollection <ValidationResult> validationResults; if (!role.Validate(out validationResults)) { var ex = new ValidationException("The object did not pass the validation."); ex.Data.Add("ValidationResults", validationResults); throw ex; } if (role.RoleID == 0) { RoleDAL.InsertRole(role); } else { RoleDAL.UpdateRole(role); } }
//Skapar en ny roll i databasen eller uppdaterar en befintlig public void SaveRole(Role role) { ICollection<ValidationResult> validationResults; if (!role.Validate(out validationResults)) { var ex = new ValidationException("The object did not pass the validation."); ex.Data.Add("ValidationResults", validationResults); throw ex; } if (role.RoleID == 0) { RoleDAL.InsertRole(role); } else { RoleDAL.UpdateRole(role); } }
//Skapar en ny film i databasen public void InsertMovie(Movie movie, Role role) { ICollection<ValidationResult> validationResults; if (!movie.Validate(out validationResults) && !role.Validate(out validationResults)) { var ex = new ValidationException("The object did not pass the validation."); ex.Data.Add("ValidationResult", validationResults); throw ex; } MovieDAL.InsertMovie(movie, role); }