Пример #1
0
        public new BllUser Create(BllUser entity)
        {
            var testEntity = uow.Users.GetUserByLogin(entity.Login);

            if (testEntity == null)
            {
                StatusLibService    statusLibService    = new StatusLibService(uow);
                EventTypeLibService eventTypeLibService = new EventTypeLibService(uow);
                entity.StatusLib    = statusLibService.Create(entity.StatusLib);
                entity.EventTypeLib = eventTypeLibService.Create(entity.EventTypeLib);
                var ormEntity = uow.Users.CreateAndReturnOrm(mapper.MapToDal(entity));
                uow.Commit();
                entity.Id = ormEntity.id;
                return(entity);
            }
            return(null);
        }
Пример #2
0
        public new BllEvent Create(BllEvent entity)
        {
            AttributeLibService attributeLibService = new AttributeLibService(uow);
            StatusLibService    statusLibService    = new StatusLibService(uow);
            UserLibService      userLibService      = new UserLibService(uow);
            FilepathLibService  filepathLibService  = new FilepathLibService(uow);

            entity.StatusLib    = statusLibService.Create(entity.StatusLib);
            entity.RecieverLib  = userLibService.Create(entity.RecieverLib);
            entity.AttributeLib = attributeLibService.Create(entity.AttributeLib);
            entity.FilepathLib  = filepathLibService.Create(entity.FilepathLib);

            var ormEntity = uow.Events.CreateAndReturnOrm(mapper.MapToDal(entity));

            uow.Commit();

            entity.Date = ormEntity.date;
            entity.Id   = ormEntity.id;

            return(entity);
        }