public void Edit(int id, DateTime updatedAt, string description, string name, string eid, int numberOfFloors, FloorCollection floors)
        {
            var project = _proxy.GetProject((id.ToString()));

            project.UpdateAt = updatedAt.ToString("s");
            project.Description = description;
            project.Name = name;
            project.ExternalIdentifier = eid;
            project.FloorsCount = numberOfFloors;
            project.Floors = floors;
            project.Floors.Type = "array";

            _proxy.EditProject(project.UserId.ToString(), id.ToString(), project);
            ((IDisposable)_proxy).Dispose();
        }
        public void Add(DateTime createdAt, string description, string name, string eid, int numberOfFloors, int userId, FloorCollection floors)
        {
            var project = new Project
                              {
                                  CreatedAt = createdAt.ToString("s"),
                                  Description = description,
                                  Name = name,
                                  ExternalIdentifier = eid,
                                  UserId = userId,
                                  FloorsCount = numberOfFloors,
                                  Floors = floors,
                              };

            project.Floors.Type = "array";

            _proxy.CreateProject(project, userId.ToString());
            ((IDisposable)_proxy).Dispose();
        }
        public ActionResult Add(int userId, FormCollection collection)
        {
            var floorsCount = Convert.ToInt32(collection["NumberOfFloors"]);
            var floors = new Floor[floorsCount];

            for (var i = 1; i < floorsCount + 1; i++)
            {
                var fieldName = string.Format("Floor{0}", i);
                var levelFieldName = string.Format("Level{0}", i);
                var heightFieldName = string.Format("Height{0}", i);
                var floor = new Floor { CreatedAt = DateTime.Now.ToString("s"), Name = collection[fieldName], Level = Convert.ToInt32(collection[levelFieldName]), Height = Convert.ToDecimal(collection[heightFieldName]) };
                floors[i - 1] = floor;
            }

            var floorsCollection = new FloorCollection { Floors = floors };

            _projectRepository.Add(DateTime.Now, collection["Description"], collection["Name"], collection["ExternalIdentifier"], floorsCount, userId, floorsCollection);

            return RedirectToAction("Index", "Project", new { id = userId });
        }
        public ActionResult Edit(int userId, int id, FormCollection collection)
        {
            var project = _projectRepository.GetProject(id);
            var floorsCount = Convert.ToInt32(collection["NumberOfFloors"]);
            var floors = new Floor[floorsCount];

            for (var i = 1; i < floorsCount + 1; i++)
            {
                var fieldName = string.Format("Floor{0}", i);
                var designCollection = new DesignCollection {Type = "array"};

                var floor = new Floor { CreatedAt = DateTime.Now.ToString("s"), Name = collection[fieldName], Designs = designCollection };
                floors[i - 1] = floor;
            }

            var floorsCollection = new FloorCollection { Floors = floors };

            _projectRepository.Edit(id, DateTime.Now, collection["Description"], collection["Name"], collection["ExternalIdentifier"], floorsCount, floorsCollection);
            return RedirectToAction("Index", "Project", new { id = project.UserId });
        }