Example #1
0
        private IdentityPropertyCategory ExtractCreateFormData(PropertyCategoryCreateModel formData)
        {
            var myIdetity = new IdentityPropertyCategory();

            myIdetity.Name   = formData.Name;
            myIdetity.Code   = formData.Code;
            myIdetity.Status = formData.Status;

            return(myIdetity);
        }
Example #2
0
        public ActionResult Create(PropertyCategoryCreateModel model)
        {
            var newId = 0;

            if (!ModelState.IsValid)
            {
                string messages = string.Join("; ", ModelState.Values
                                              .SelectMany(x => x.Errors)
                                              .Select(x => x.ErrorMessage + x.Exception));
                this.AddNotification(messages, NotificationType.ERROR);
                return(View(model));
            }

            try
            {
                //Extract info
                var info = ExtractCreateFormData(model);

                newId = _mainStore.Insert(info);

                //Clear cache
                CachingHelpers.ClearPropertyCategoryCache();

                if (newId > 0)
                {
                    this.AddNotification(ManagerResource.LB_INSERT_SUCCESS, NotificationType.SUCCESS);
                }
                else
                {
                    this.AddNotification(NotifSettings.Error_SystemBusy, NotificationType.ERROR);
                }
            }
            catch (Exception ex)
            {
                this.AddNotification(NotifSettings.Error_SystemBusy, NotificationType.ERROR);

                logger.Error("Failed for Create PropertyCategory request: " + ex.ToString());

                return(View(model));
            }

            return(RedirectToAction("Edit/" + newId));
        }
Example #3
0
        public ActionResult Create()
        {
            var createModel = new PropertyCategoryCreateModel();

            return(View(createModel));
        }