Пример #1
0
 public PaperDO(GvaPaper paper)
 {
     this.PaperId = paper.PaperId;
     this.Name = paper.Name;
     this.FromDate = paper.FromDate;
     this.ToDate = paper.ToDate;
     this.FirstNumber = paper.FirstNumber;
     this.IsActive = paper.IsActive;
 }
Пример #2
0
        public IHttpActionResult PostNewPaper(PaperDO paper)
        {
            using (var transaction = this.unitOfWork.BeginTransaction())
            {
                GvaPaper newPaper = new GvaPaper()
                {
                    Name = paper.Name,
                    IsActive = paper.IsActive,
                    FromDate = paper.FromDate.Value,
                    ToDate = paper.ToDate.Value,
                    FirstNumber = paper.FirstNumber.Value
                };

                this.unitOfWork.DbContext.Set<GvaPaper>().Add(newPaper);

                this.unitOfWork.Save();

                transaction.Commit();

                return Ok();
            }
        }