Esempio n. 1
0
 public async System.Threading.Tasks.Task <ActionResult> CreateSubcategory(SubCategoryMaster sub)
 {
     if (ModelState.IsValid)
     {
         List <string> res         = new List <string>();
         var           currentuser = Commonhelper.GetCurrentUserDetails();
         if (ModelState.IsValid)
         {
             try
             {
                 SubCategoryMaster master = new SubCategoryMaster();
                 master.Id            = Guid.NewGuid().ToString();
                 master.CreatedBy     = currentuser.Id;
                 master.CreatedDate   = DateTime.Now;
                 master.Name          = sub.Name;
                 master.CategoryId    = sub.CategoryId;
                 master.Description   = sub.Description;
                 master.StoreId       = currentuser.StoreId;
                 master.workstation   = Commonhelper.GetStation();
                 master.FinancialYear = DateTime.Now.Year;
                 master.CompanyId     = currentuser.CompanyId;
                 master.Isactive      = true;
                 try
                 {
                     Commonhelper.SaveSubCategory(master);
                     return(RedirectToAction("Subcategory"));
                 }
                 catch (Exception ex)
                 {
                     return(RedirectToAction("Subcategory"));
                 }
             }
             catch (Exception ex)
             {
                 return(RedirectToAction("Subcategory"));
             }
         }
         else
         {
         }
     }
     return(View());
 }