예제 #1
0
        public static void Create(ProjectStatusDto dto)
        {
            using (var db = new MainDBModelContainer())
            {
                var entity = ProjectStatusMapper.DtoToEntity(dto);

                db.ProjectStatusSet.Add(entity);
                db.SaveChanges();
            }
        }
예제 #2
0
        public static void Update(ProjectStatusDto dto)
        {
            using (var db = new MainDBModelContainer())
            {
                var newData = ProjectStatusMapper.DtoToEntity(dto);
                var oldData = db.ProjectStatusSet.Find(dto.Id);
                if (oldData != null)
                {
                    oldData.Name = newData.Name;

                    db.SaveChanges();
                }
                else
                {
                    throw new ElementNotFoundException();
                }
            }
        }