//[AccessRoleChecker]
        public ActionResult Create()
        {
            var createModel = new PropertyCreateModel();

            createModel.GroupList = _groupStore.GetAll();
            return(View(createModel));
        }
Exemple #2
0
        public ActionResult Create(PropertyCreateInputModel input, string command)
        {
            if (ModelState.IsValid)
            {
                var result = this.propertyAdapter.CreateProperty(input.ToBuilding());

                if (result.StatusCode == 200)
                {
                    if (command == "list")
                    {
                        return(RedirectToAction("list", new { id = result.Result.BuildingId }));
                    }

                    if (command == "save")
                    {
                        return(RedirectToAction("manage", new { id = result.Result.BuildingId }));
                    }
                }

                HandleErrors(result);
            }

            PropertyCreateModel model = new PropertyCreateModel(input);

            return(View(model));
        }
        private IdentityProperty ExtractCreateFormData(PropertyCreateModel formData)
        {
            var myIdetity = new IdentityProperty();

            myIdetity.Name = formData.Name;
            //myIdetity.UrlFriendly = UrlFriendly.ConvertToUrlFriendly(formData.Name);
            myIdetity.Icon               = formData.Icon;
            myIdetity.Status             = Utils.ConvertToInt32(formData.Status);
            myIdetity.CreatedBy          = User.Identity.GetUserId();
            myIdetity.PropertyCategoryId = formData.PropertyCategoryId;

            return(myIdetity);
        }
Exemple #4
0
        public ActionResult Create()
        {
            PropertyCreateModel model = new PropertyCreateModel();

            model.StepsAvailable = GetStepsAvailable(null);
            var result = this.propertyAdapter.GetInfoForNewProperty(User.Identity.Name);

            if (result.StatusCode != 200)
            {
                return(HttpNotFound());
            }
            model.Input = result.Result;
            return(View(model));
        }
Exemple #5
0
        public ActionResult Create(Building input)
        {
            if (ModelState.IsValid)
            {
                // set some defaults for terms on create
                input.LeaseLength    = LeaseLength.Year;
                input.ArePetsAllowed = true;

                var result = this.propertyAdapter.CreateBuilding(User.Identity.Name, input);

                if (result.StatusCode == 200)
                {
                    return(RedirectToAction("terms", new { id = result.Result.BuildingId }));
                }

                HandleErrors(result);
            }

            // validate
            var freshBuilding = this.propertyAdapter.GetInfoForNewProperty(User.Identity.Name);

            if (freshBuilding.StatusCode != 200)
            {
                return(HttpNotFound());
            }

            // add missing info
            if (input.CustomAmenities == null)
            {
                input.CustomAmenities = freshBuilding.Result.CustomAmenities;
            }

            if (input.ContactInfo == null)
            {
                input.ContactInfo = freshBuilding.Result.ContactInfo;
            }

            input.User = freshBuilding.Result.User;

            // return
            PropertyCreateModel model = new PropertyCreateModel();

            model.Input          = input;
            model.StepsAvailable = GetStepsAvailable(freshBuilding.Result);

            return(View(model));
        }
        public ActionResult Create(PropertyCreateModel 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
            {
                //Begin db transaction
                var info = ExtractCreateFormData(model);

                newId = _mainStore.Insert(info);

                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 Property request: " + ex.ToString());

                return(View(model));
            }

            return(RedirectToAction("Edit/" + newId));
        }
Exemple #7
0
 public static CopyProperty ToEntity(this PropertyCreateModel model, CopyProperty destination)
 {
     return(model.MapTo(destination));
 }
Exemple #8
0
 public static CopyProperty ToCopyEntity(this PropertyCreateModel model)
 {
     return(model.MapTo <PropertyCreateModel, CopyProperty>());
 }
Exemple #9
0
 public static Property ToEntity(this PropertyCreateModel createmodel, Property destination)
 {
     return(createmodel.MapTo(destination));
 }
Exemple #10
0
 public static Property ToEntity(this PropertyCreateModel createmodel)
 {
     return(createmodel.MapTo <PropertyCreateModel, Property>());
 }
Exemple #11
0
        public ActionResult Create()
        {
            PropertyCreateModel model = new PropertyCreateModel();

            return(View(model));
        }