public ActionResult Edit(PropertyEditInputModel input, string command)
        {
            if (ModelState.IsValid)
            {
                var request = this.propertyAdapter.UpdateProperty(input.ToBuilding());

                if (request.StatusCode == 200)
                {
                    if (command == "save")
                    {
                        string uri = string.Format(
                            "{0}/dashboard/property/manage/{1}",
                            Config.Hostname,
                            request.Result.BuildingId
                            );

                        return(Redirect(uri));
                    }

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

                    HandleErrors(request);
                }
            }

            PropertyEditModel model = new PropertyEditModel(input);

            return(View(model));
        }
Example #2
0
        public ActionResult Edit(PropertyEditInputModel input, string command)
        {
            if (ModelState.IsValid)
            {
                var request = this.propertyAdapter.UpdateProperty(input.ToBuilding());

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

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

                    HandleErrors(request);
                }
            }

            PropertyEditModel model = new PropertyEditModel(input);

            return(View(model));
        }