예제 #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();
 }