public new BllEvent Update(BllEvent entity)
        {
            AttributeLibService attributeLibService = new AttributeLibService(uow);
            StatusLibService    statusLibService    = new StatusLibService(uow);
            UserLibService      userLibService      = new UserLibService(uow);
            FilepathLibService  filepathLibService  = new FilepathLibService(uow);

            attributeLibService.Update(entity.AttributeLib);
            statusLibService.Update(entity.StatusLib);
            userLibService.Update(entity.RecieverLib);
            filepathLibService.Update(entity.FilepathLib);
            uow.Events.Update(mapper.MapToDal(entity));
            uow.Commit();

            return(mapper.MapToBll(uow.Events.Get(entity.Id)));
        }
Esempio n. 2
0
        public new BllUser Update(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.Update(entity.StatusLib);
                entity.EventTypeLib = eventTypeLibService.Update(entity.EventTypeLib);
                var ormEntity = uow.Users.Update(mapper.MapToDal(entity));
                uow.Commit();

                return(mapper.MapToBll(uow.Users.Get(entity.Id)));
            }
            return(null);
        }
Esempio n. 3
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);
        }
        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);
        }