Пример #1
0
        public IHttpActionResult getCategoryByCode([FromUri] CategoryCode categoryCode)
        {
            Response response = new Response();

            if (categoryCode == null)
            {
                response.code   = "400";
                response.status = "Thiếu mã loại sản phẩm";
                return(Content <Response>(HttpStatusCode.BadRequest, response));
            }
            Category category = Service.categoryDAO.getCategoryByCode(categoryCode.code);

            response = new Response("200", "Thành công", category);
            return(Content <Response>(HttpStatusCode.OK, response));
        }
        public IActionResult Put([FromODataUri] long key, [FromBody] Delta <CategoryCode> delta)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            CategoryCode record = _dbContext.CategoryCodes.SingleOrDefault(r => r.Id == key);

            if (record == null)
            {
                return(NotFound());
            }

            _logger.LogDebug("Updating {id}", record.Id);
            delta.Put(record);
            SaveChanges();
            _logger.LogDebug("Updated {id}", record.Id);

            return(Updated(record));
        }
        public IActionResult Post([FromBody] CategoryCode record)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _logger.LogDebug("Inserting {id}", record.Id);
            _dbContext.CategoryCodes.Add(record);
            SaveChanges();
            _logger.LogDebug("Inserted {id}", record.Id);

            //         if (record.Recipes != null)
            //         {
            //          _logger.LogDebug("Inserting recipes", record.Id);
            //          _dbContext.Recipes.AddRange(record.Recipes);
            //          _logger.LogDebug("Inserted recipes", record.Id);
            //	SaveChanges();
            //}

            return(Created(record));
        }
Пример #4
0
 public void setLiteral()
 {
     code |= CategoryCode.literal;
 }
Пример #5
0
 public void setStatement()
 {
     code |= CategoryCode.statement;
 }
Пример #6
0
 public void setSpecifier()
 {
     code |= CategoryCode.specifier;
 }
Пример #7
0
 public void setTrivia()
 {
     code |= CategoryCode.trivia;
 }
Пример #8
0
 public void setKeyword()
 {
     code |= CategoryCode.keyword;
 }
Пример #9
0
 public void setIdentifier()
 {
     code |= CategoryCode.identifier;
 }
Пример #10
0
 public void setOperator()
 {
     code |= CategoryCode.operatorr;
 }
Пример #11
0
 public void setDelimiter()
 {
     code |= CategoryCode.delimiter;
 }
Пример #12
0
 public Category(CategoryCode c)
 {
     code = c;
 }
Пример #13
0
 public Category()
 {
     code = 0;
 }
Пример #14
0
 public ErrorItemCoded(string parameter, string description, object value, CategoryCode category, short code) :
     base(parameter, description, value)
 {
     Category = category;
     Code     = code;
 }