예제 #1
0
        public async Task <ActionResult> Post(ProductViewModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    ProductViewModel result = await productBLL.AddAsync(model);

                    if (result != null)
                    {
                        return(Ok(new { status = 200, message = "Product added succesfull.", obj = result }));
                    }
                }
            }
            catch (Exception e)
            {
            }
            return(BadRequest(new { status = 400, message = "Sorry! Something went wrong please try again." }));
        }