Exemple #1
0
        public ActionResult CreateCategory(CategoryMaster category)
        {
            List <string> res         = new List <string>();
            var           currentuser = Commonhelper.GetCurrentUserDetails();

            if (ModelState.IsValid)
            {
                try
                {
                    CategoryMaster master = new CategoryMaster();
                    master.Id            = Guid.NewGuid().ToString();
                    master.CreatedBy     = currentuser.Id;
                    master.CreatedDate   = DateTime.Now;
                    master.Name          = category.Name;
                    master.Discount      = category.Discount;
                    master.StoreId       = currentuser.StoreId;
                    master.workstation   = Commonhelper.GetStation();
                    master.FinancialYear = DateTime.Now.Year;
                    master.CompanyId     = currentuser.CompanyId;
                    master.Isactive      = true;
                    try
                    {
                        Commonhelper.SaveCategory(master);
                        return(RedirectToAction("Category"));
                    }
                    catch (Exception ex)
                    {
                        return(RedirectToAction("Category"));
                    }
                }
                catch (Exception ex)
                {
                    return(RedirectToAction("Category"));
                }
            }
            else
            {
            }

            return(RedirectToAction("Category"));
        }