Exemplo n.º 1
0
        public IHttpActionResult AddEnumCategory(tbl_EnumCategory item)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            CRUDOperation    operation = new CRUDOperation();
            tbl_EnumCategory dbitem    = operation.AddEnumCategory(item);

            return(Ok(dbitem));
        }
Exemplo n.º 2
0
        public ActionResult Create(EnumVM viewModel)
        {
            try
            {
                var UserProfile = (UserProfileSessionData)this.Session["UserProfile"];
                if (UserProfile != null)
                {
                    tbl_EnumCategory item = new tbl_EnumCategory()
                    {
                        Code        = viewModel.EnumCategoryCode,
                        Name        = viewModel.EnumCategoryName,
                        Description = viewModel.EnumCategoryDesc,
                        InsertDate  = DateTime.Now,
                        InsertUser  = UserProfile.UserId
                    };

                    CRUDOperation    dataOperations = new CRUDOperation();
                    tbl_EnumCategory dbItem         = dataOperations.AddEnumCategory(item);
                    if (dbItem != null)
                    {
                        TempData["success"] = "Ok";
                        TempData["message"] = "Məlumatlar uğurla əlavə olundu";
                        return(RedirectToAction("Index"));
                    }
                    else
                    {
                        TempData["success"] = "notOk";
                        TempData["message"] = "Məlumatlar əlavə olunarkən xəta baş verdi";
                        return(RedirectToAction("Index"));
                    }
                }
            }
            catch (ApplicationException ex)
            {
                return(View(viewModel));
            }
            throw new ApplicationException("Invalid model");
        }