Exemple #1
0
        public override OperationResult Execute(AspSiteBazaEntities entities)
        {
            AspNetRole role = new AspNetRole();

            role.Name = this.Role.Name;
            role.Id   = Guid.NewGuid().ToString();
            entities.AspNetRoles.Add(role);

            entities.SaveChanges();

            return(base.Execute(entities));
        }
Exemple #2
0
        public override OperationResult Execute(AspSiteBazaEntities entities)
        {
            AspNetUser user = new AspNetUser();

            user.UserName     = this.User.UserName;
            user.Id           = Guid.NewGuid().ToString();
            user.Email        = this.User.Email;
            user.PasswordHash = this.User.PasswordHash;

            entities.AspNetUsers.Add(user);
            entities.SaveChanges();
            return(base.Execute(entities));
        }
Exemple #3
0
        public override OperationResult Execute(AspSiteBazaEntities entities)
        {
            Contact contact = new Contact();

            contact.email   = this.Dto.Email;
            contact.message = this.Dto.Message;
            contact.website = this.Dto.Website;

            entities.Contacts.Add(contact);
            entities.SaveChanges();

            return(base.Execute(entities));
        }
Exemple #4
0
        public override OperationResult Execute(AspSiteBazaEntities entities)
        {
            Comment com = new Comment
            {
                product_id = komentar_prenos.ProductId,
                user_id    = komentar_prenos.UserId,
                content    = komentar_prenos.Content
            };

            entities.Comments.Add(com);
            entities.SaveChanges();
            return(base.Execute(entities));
        }
Exemple #5
0
        public override OperationResult Execute(AspSiteBazaEntities entities)
        {
            AspNetRole role = entities.AspNetRoles.Where(r => r.Id == Role.UUID).FirstOrDefault();

            if (role != null)
            {
                role.Name = Role.Name;
                entities.SaveChanges();
                return(base.Execute(entities));
            }
            else
            {
                OperationResult result = new OperationResult();
                result.Status  = false;
                result.Message = "The role doesn't exist or has some users";
                return(result);
            }
        }
Exemple #6
0
        public override OperationResult Execute(AspSiteBazaEntities entities)
        {
            AspNetUser user = entities.AspNetUsers.Where(r => r.Id == Uuid).FirstOrDefault();

            if (user != null)
            {
                entities.AspNetUsers.Remove(user);
                entities.SaveChanges();
                return(base.Execute(entities));
            }
            else
            {
                OperationResult result = new OperationResult();
                result.Status  = false;
                result.Message = "The user doesn't exist.";
                return(result);
            }
        }
Exemple #7
0
        public override OperationResult Execute(AspSiteBazaEntities entities)
        {
            //Product single = entities.Products.Find(Id);
            Product single = entities.Products.Where(r => r.product_id == Id).FirstOrDefault();

            if (single != null)
            {
                //entities.Entry(single).State = System.Data.Entity.EntityState.Deleted;
                entities.Products.Remove(single);
                entities.SaveChanges();
                return(base.Execute(entities));
            }
            else
            {
                OperationResult result = new OperationResult();
                result.Status  = false;
                result.Message = "The post doesn't exist.";
                return(result);
            }
        }
Exemple #8
0
        public override OperationResult Execute(AspSiteBazaEntities entities)
        {
            AspNetUser user = entities.AspNetUsers.Where(r => r.Id == User.UUID).FirstOrDefault();

            if (user != null)
            {
                user.UserName     = User.UserName;
                user.Email        = User.Email;
                user.PasswordHash = User.PasswordHash;
                entities.SaveChanges();
                return(base.Execute(entities));
            }
            else
            {
                OperationResult result = new OperationResult();
                result.Status  = false;
                result.Message = "The user doesn't exist.";
                return(result);
            }
        }
Exemple #9
0
        public override OperationResult Execute(AspSiteBazaEntities entities)
        {
            Product sing = new Product();

            sing.header      = Dto.Header;
            sing.description = this.Dto.Description;
            foreach (var picture in this.Dto.Pictures)
            {
                Picture p = new Picture
                {
                    alt = picture.Alt,
                    src = picture.Src
                };
                sing.Pictures.Add(p);
            }

            entities.Products.Add(sing);
            entities.SaveChanges();
            return(base.Execute(entities));
        }