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)); }
public void setLiteral() { code |= CategoryCode.literal; }
public void setStatement() { code |= CategoryCode.statement; }
public void setSpecifier() { code |= CategoryCode.specifier; }
public void setTrivia() { code |= CategoryCode.trivia; }
public void setKeyword() { code |= CategoryCode.keyword; }
public void setIdentifier() { code |= CategoryCode.identifier; }
public void setOperator() { code |= CategoryCode.operatorr; }
public void setDelimiter() { code |= CategoryCode.delimiter; }
public Category(CategoryCode c) { code = c; }
public Category() { code = 0; }
public ErrorItemCoded(string parameter, string description, object value, CategoryCode category, short code) : base(parameter, description, value) { Category = category; Code = code; }