Пример #1
0
 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;
 }
Пример #2
0
        public void Update(Category obj)
        {
            var procedure = new ProcedureSql("Update_Category");

            procedure.AddParameter("@Id", obj.Id);
            procedure.AddParameter("@Name", obj.Name);

            procedure.Execute();
        }
Пример #3
0
        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();            
        }
Пример #4
0
        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;
        }
Пример #5
0
        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;
        }
Пример #6
0
 public ActionResult Save(Category category)
 {
     return View();
 }