public static dto.Project ConvertProject(dal.Project project)
        {
            dto.Project ret = new dto.Project();
            ret.Id = project.Id;
            ret.UserId = project.UserId;
            ret.BadPoint = project.BadPoint;
            ret.GoodPoint = project.GoodPoint;
            ret.Name = project.Name;
            ret.StartDate = project.StartDate;
            ret.Position = project.Position;

            ret.FinishedSteps = project.FinishedSteps.Select(s => StepConverter.ConvertStep(s)).ToList();
            return ret;
        }
Exemple #2
0
        public ActionResult CreateProject(int position)
        {
            var client = CreateClient();
            logger.Debug("HttpRequestHeader.Authorization: {0}", client.Headers[HttpRequestHeader.Authorization]);

            Project p = new Project()
            {
                Name = "New project",
                StartDate = DateTime.Now,
                GoodPoint = 0,
                BadPoint = 0,
                Position = position,
                FinishedSteps = new List<Step>() { new Step() { Name = "First step", Deadline = DateTime.Now, FinishDate = null, SentReminder = 0 } }
            };
            string json = System.Web.Helpers.Json.Encode(p);

            //TODO: error handling
            client.UploadString(Address, "POST", json);
            return View("Index", GetProjects());
        }