Exemple #1
0
        //Added by sanjeet on 16th may 2016
        public IHttpActionResult InsertProductType(ProductTypeMaster ProductType)
        {
            string status = "";

            try
            {
                if (ProductType.parenttypeid == null)
                {
                    ProductType.typelevel = 1;
                }
                else
                {
                    ProductType.typelevel = 2;
                }
                status = _productTypeService.DuplicityCheck(ProductType);
                if (status == "Y")
                {
                    if (ProductType.Id == 0)
                    {
                        _productTypeService.InsertProductType(ProductType);
                    }
                    else
                    {
                        ProductTypeMaster mobj_producttype = _productTypeService.GetProductTypeById(ProductType);
                        mobj_producttype.typeName     = ProductType.typeName;
                        mobj_producttype.typelevel    = ProductType.typelevel;
                        mobj_producttype.parenttypeid = ProductType.parenttypeid;
                        mobj_producttype.ModifiedBy   = ProductType.EnteredBy;
                        mobj_producttype.ModifiedDate = System.DateTime.Now;
                        _productTypeService.UpdateProductType(mobj_producttype);
                    }
                    status = _localizationService.GetResource("Master.API.Success.Message");
                }
                else
                {
                    status = "Duplicate";
                }
            }
            catch (ACSException ex)
            {
                status = ex.InnerException.Message;
            }
            catch (Exception ex)
            {
                status = ex.InnerException.Message;
            }

            return(Json(status));
        }