public IActionResult AddorEditProductByAdmin([FromBody] Products_Types model)
        {
            IARresponse = Unauthorized();

            Products_Types product = new Products_Types();

            try
            {
                product.PID      = model.PID;
                product.pName    = model.pName;
                product.IsActive = 1;

                if (objadmindb.AddorEditProductByAdmin(product) == "")
                {
                    IARresponse = Ok(new { res = "Products Added / Updated Successfully" });
                }
                else
                {
                    IARresponse = BadRequest(new { res = "Products not Added / Updated... try again later!.." + objadmindb.AddorEditProductByAdmin(product) });
                }
            }
            catch (Exception ex)
            {
                IARresponse = BadRequest(new { res = ex.Message });
            }
            return(IARresponse);
        }
Beispiel #2
0
        public string AddorEditProductByAdmin(Products_Types product)
        {
            CmdCAP = new SqlCommand();


            CmdCAP.Parameters.Add(CommonDbFunctions.AddParameter("@PID", SqlDbType.Int, 0, product.PID));
            CmdCAP.Parameters.Add(CommonDbFunctions.AddParameter("@pName", SqlDbType.VarChar, 100, string.IsNullOrEmpty(product.pName) ? SqlString.Null : product.pName));
            CmdCAP.Parameters.Add(CommonDbFunctions.AddParameter("@IsActive", SqlDbType.Bit, 0, product.IsActive));


            ErrorMessage = CommonDbFunctions.SqlCommandExecution(CommandType.StoredProcedure, "spAddorEditProductByAdmin", CmdCAP);
            return(ErrorMessage);
        }