public static AttributeCategory ToDataModel(this Contracts.AttributeCategory.CreateAttributeCategory create) { return(new AttributeCategory { Name = create.Name, Description = create.Description, AttributeTypeId = create.AttributeTypeId, CreatedOn = DateTime.Now, UpdatedOn = DateTime.Now, }); }
public Contracts.AttributeCategory.AttributeCategory Create(Contracts.AttributeCategory.CreateAttributeCategory create) { using (var db = new RAAPEntities(GetConnectionString())) { var category = create.ToDataModel(); db.AttributeCategories.Add(category); db.SaveChanges(); return(category.ToContract()); } }
public IHttpActionResult Post([FromBody] Contracts.AttributeCategory.CreateAttributeCategory create) { AttributeCategoryService.Create(create); return(Ok()); }