Exemplo n.º 1
0
 public static LogbookViewModel MapFrom(this LogbookDTO dto)
 {
     return(new LogbookViewModel()
     {
         Id = dto.Id,
         Name = dto.Name,
         Picture = dto.Picture,
         BusinessUnitName = dto.BusinessUnitName
     });
 }
Exemplo n.º 2
0
        public static Guid CreateLogbook(LogbookDTO logbook)
        {
            logbook.LogbookId = Guid.NewGuid();

            using (var conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Local"].ConnectionString))
            {
                conn.Execute("INSERT INTO Logbook (LogbookId, UserId, Name, DefaultActivityId, CreatedBy, UpdatedBy, Status) " +
                             "OUTPUT inserted.LogbookId " +
                             "VALUES (@LogbookId, @UserId, @Name, @DefaultActivityId, @CreatedBy, @UpdatedBy, @Status)",
                             logbook);
            }
            return(logbook.LogbookId);
        }
Exemplo n.º 3
0
        public async Task <ActionResult> CreateLogbook(CreateLogbookViewModel model)
        {
            var logbook = new LogbookDTO();

            logbook.UserId            = Guid.Parse(User.Identity.GetUserId());
            logbook.Name              = model.Name;
            logbook.DefaultActivityId = model.DefaultActivityId;
            logbook.Status            = "STATUS/ACTIVE";
            logbook.CreatedBy         = Guid.Parse(User.Identity.GetUserId());
            logbook.UpdatedBy         = Guid.Parse(User.Identity.GetUserId());
            logbook.CreateDate        = DateTime.Now;
            logbook.UpdateDate        = DateTime.Now;
            DataAccess.CreateLogbook(logbook);
            if (logbook.LogbookId == Guid.Empty)
            {
                ModelState.AddModelError("", "Failed to create logbook");
            }
            else
            {
                return(RedirectToAction("Logbook", "Logbook", new { logbookId = logbook.LogbookId }));
            }
            return(View());
        }
Exemplo n.º 4
0
 private static string LogbookUrl(LogbookDTO logbook)
 {
     return($"<a href =\"/Logbook/{logbook.LogbookId}\">{logbook.Name}</a>");
 }
Exemplo n.º 5
0
 public FrmModifierEntretien(GestionLogbook gestionLogbook, LogbookDTO logbookDTO)
 {
     InitializeComponent();
 }