private Category FillCategory(SqlDataReader reader) { var author = new Category(); author.Id = reader.GetInt32(0); author.Name = reader.GetString(1); author.DateCreated = reader.GetDateTime(2); return author; }
public void Update(Category obj) { var procedure = new ProcedureSql("Update_Category"); procedure.AddParameter("@Id", obj.Id); procedure.AddParameter("@Name", obj.Name); procedure.Execute(); }
public void Add(Category obj) { var procedure = new ProcedureSql("Add_Category"); procedure.AddParameter("@Id", SqlDbType.Int, ParameterDirection.Output); procedure.AddParameter("@Name", obj.Name); procedure.AddParameter("@DateCreated", obj.DateCreated); obj.Id = procedure.Insert(); }
public IValidationResult Update(Category obj) { if (obj == null) throw new NullReferenceException("obj"); var validationResult = this.categoryValidation.Validate(obj); if (validationResult.IsValid) this.categoryRepository.Update(obj); return validationResult; }
public IValidationResult Add(Category obj) { if (obj == null) throw new NullReferenceException("obj"); obj.DateCreated = DateTime.UtcNow; var validationResult = this.categoryValidation.Validate(obj); if(validationResult.IsValid) this.categoryRepository.Add(obj); return validationResult; }
public ActionResult Save(Category category) { return View(); }