コード例 #1
0
        public ActionResult GetProject(int?id)
        {
            try
            {
                Logica.BL.Projects projects = new Logica.BL.Projects();
                var project = projects.GetProjects(id, null).FirstOrDefault();

                var projectDetailsViewModel = new Logica.Models.ViewModels.ProjectsDetailsViewModel
                {
                    Details = project.Details,
                    ExpectedCompletionDateString = project.ExpectedCompletionDate == null ? string.Empty : project.ExpectedCompletionDate.Value.ToString("yyyy-MM-dd HH:mm:ss"),
                    Title           = project.Title,
                    CreatedAtString = project.CreatedAt == null ? string.Empty : project.CreatedAt.Value.ToString("yyyy-MM-dd HH:mm:ss"),
                    UpdatedAtString = project.UpdatedAt == null ? string.Empty : project.UpdatedAt.Value.ToString("yyyy-MM-dd HH:mm:ss")
                };

                return(Json(new
                {
                    IsSuccessful = true,
                    Data = projectDetailsViewModel
                }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(Json(new Logica.Models.ViewModels.ResponseViewModel
                {
                    IsSuccessful = false,
                    Errors = new List <string> {
                        ex.Message
                    }
                }, JsonRequestBehavior.AllowGet));
            }
        }
コード例 #2
0
        public ActionResult Details(int?id)
        {
            Logica.BL.Projects projects = new Logica.BL.Projects();
            var project = projects.GetProjects(id, null).FirstOrDefault();

            var projectDetailsViewModel = new Logica.Models.ViewModels.ProjectsDetailsViewModel
            {
                Title   = project.Title,
                Details = project.Details,
                ExpectedCompletionDate = project.ExpectedCompletionDate,
                CreatedAt = project.CreatedAt,
                UpdatedAt = project.UpdatedAt
            };

            return(View(projectDetailsViewModel));
        }