public HttpStatusMessageActionResult AddProduct([FromBody]ProductDTO productDTO)
		{
			ApiStatusMessage statusMsg = new ApiStatusMessage();

			try
			{
				Product product = new Product()
				{
					Name = productDTO.Name,
					Price = productDTO.Price,
					ProductCode = productDTO.ProductCode,
					ImageUrl = productDTO.ImageUrl,
					BrandName = productDTO.BrandName,
					Description = productDTO.Description
				};

				ProductsModule.AddProduct(product);

				statusMsg.ApiResponseStatusCode = ApiResponseStatusCode.Success;
				statusMsg.ApiStatusPlainText = ApiStatusMessages.Product_Add_Success;
			}
			catch (Exception e)
			{
				if (e is EntryAlreadyExistsException)
				{
					statusMsg.ApiStatusPlainText = ApiStatusMessages.Product_Add_Failure_Product_Already_Exists;
				}
				else
				{
					statusMsg.ApiStatusPlainText = ApiStatusMessages.Product_Add_Failure;
				}
				statusMsg.ApiResponseStatusCode = ApiResponseStatusCode.CRUDoperationError;
				statusMsg.StackTrace = e.StackTrace;
			}

			return new HttpStatusMessageActionResult(HttpStatusCode.Accepted, statusMsg, Request);
		}
 public static void UpdateProduct(Product product)
 {
     CommonDAL.UpdateEntity<Product>(product);
 }
		public static void AddProduct(Product product)
		{
			CommonDAL.AddEntity<Product>(product, p => p.Name == product.Name);
		}
        public HttpStatusMessageActionResult UpdateProduct([FromBody]ProductDTO productDTO)
        {
            ApiStatusMessage statusMsg = new ApiStatusMessage();

            try
            {
				Product product = new Product()
				{
					Id = productDTO.Id,
					Name = productDTO.Name,
					Price = productDTO.Price,
					ProductCode = productDTO.ProductCode,
					ImageUrl = productDTO.ImageUrl,
					BrandName = productDTO.BrandName,
					Description = productDTO.Description
				};

				ProductsModule.UpdateProduct(product);

                statusMsg.ApiStatusPlainText = ApiStatusMessages.Product_Update_Success;
                statusMsg.ApiResponseStatusCode = ApiResponseStatusCode.Success;
            }
            catch (Exception e)
            {
                statusMsg.ApiStatusPlainText = ApiStatusMessages.Product_Update_Failure;
                statusMsg.ApiResponseStatusCode = ApiResponseStatusCode.CRUDoperationError;
                statusMsg.StackTrace = e.StackTrace;
            }

            return new HttpStatusMessageActionResult(HttpStatusCode.Accepted, statusMsg, Request);
        }