Exemplo n.º 1
0
        public SubprocessDTO PutSubprocess(int id, [FromBody] SubprocessDTO s)
        {
            var sp = dbm.FindSubprocessByID(id);

            bool changesMade = false;

            if (s.Description != null && s.Description != "" && sp.Description != s.Description)
            {
                sp.Description = s.Description;
                changesMade    = true;
            }
            if (s.ProcessID > 0 && sp.Process.ProcessID != s.ProcessID)
            {
                sp.Process  = dbm.FindProcessByID(s.ProcessID);
                changesMade = true;
            }
            if (s.TeamID > 0 && sp.Team.TeamID != s.TeamID)
            {
                sp.Team     = dbm.FindTeamByID(s.TeamID);
                changesMade = true;
            }

            if (changesMade)
            {
                db.SaveChanges();
            }
            return(converter.SubprocessToDTO(sp));
        }
Exemplo n.º 2
0
 public ProcessDTO GetProcess(int id)
 {
     return(converter.ProcessToDTO(dbm.FindProcessByID(id)));
 }
Exemplo n.º 3
0
 public Subprocess DTOToSubprocess(SubprocessDTO a)
 {
     return(new Subprocess {
         Description = a.Description, Process = dbm.FindProcessByID(a.ProcessID), SubprocessID = a.SubprocessID, Team = dbm.FindTeamByID(a.TeamID)
     });
 }