public IActionResult Add(VMCategoryAttribute vmCategoryAttribute) { TbCategoryAttribute tbCategoryattribute = mapper.Map <VMCategoryAttribute, TbCategoryAttribute>(vmCategoryAttribute); unitOfWork.CategoryAttributes.Add(tbCategoryattribute); unitOfWork.Complete(); vmCategoryAttribute.Id = tbCategoryattribute.Id; return(Ok(vmCategoryAttribute)); }
public IActionResult Delete(int id) { TbCategoryAttribute categoryattribute = unitOfWork.CategoryAttributes.Get(id); if (categoryattribute == null) { return(NotFound()); } unitOfWork.CategoryAttributes.Remove(categoryattribute); unitOfWork.Complete(); return(Ok()); }
public IActionResult Edit(VMCategoryAttribute vmCategoryAttribute) { TbCategoryAttribute tbCategory = unitOfWork.CategoryAttributes.Get(vmCategoryAttribute.Id); if (tbCategory == null) { return(NotFound()); } tbCategory = mapper.Map <VMCategoryAttribute, TbCategoryAttribute>(vmCategoryAttribute); unitOfWork.Complete(); return(Ok(vmCategoryAttribute)); }
public IActionResult Get(int id) { TbCategoryAttribute categoryattribute = unitOfWork.CategoryAttributes.Get(id); if (categoryattribute == null) { return(NotFound()); } VMCategoryAttribute vMCategory = mapper.Map <TbCategoryAttribute, VMCategoryAttribute>(categoryattribute); return(Ok(vMCategory)); }