Exemple #1
0
        public Contracts.AttributeCategory.AttributeCategory Update(Contracts.AttributeCategory.UpdateAttributeCategory update)
        {
            using (var db = new RAAPEntities(GetConnectionString()))
            {
                var category = db.AttributeCategories.FirstOrDefault(a => a.AttributeCategoryId == update.AttributeCategoryId);
                if (category == null)
                {
                    throw new RAAPNotFoundException("Item not found.");
                }
                category.ApplyUpdate(update);
                db.SaveChanges();

                return(category.ToContract());
            }
        }
Exemple #2
0
 public static void ApplyUpdate(this AttributeCategory dataItem, Contracts.AttributeCategory.UpdateAttributeCategory update)
 {
     dataItem.Name        = update.Name;
     dataItem.Description = update.Description;
     dataItem.UpdatedOn   = DateTime.Now;
 }
Exemple #3
0
 public IHttpActionResult Put([FromBody] Contracts.AttributeCategory.UpdateAttributeCategory update)
 {
     AttributeCategoryService.Update(update);
     return(Ok());
 }