示例#1
0
        public override OperationResult execute(CimetEntities entities)
        {
            IEnumerable <RoleDto> ieRole =
                from uloga in entities.AspNetRoles
                select new RoleDto
            {
                Id   = uloga.Id,
                Name = uloga.Name
            };

            //ovde prosirujemo upit
            if (!criteria.Uuid.IsNullOrWhiteSpace())
            {
                ieRole = ieRole.Where(r => r.Id == criteria.Uuid);
            }

            if (!criteria.Name.IsNullOrWhiteSpace())
            {
                ieRole = ieRole.Where(r => r.Name == criteria.Name);
            }

            OperationResult result = new OperationResult();

            result.Items  = ieRole.ToArray();
            result.Status = true;
            return(result);
        }
示例#2
0
        public override OperationResult execute(CimetEntities entities)
        {
            AspNetRoles role = new AspNetRoles();

            role.Name = this.Role.Name;
            role.Id   = this.Role.Uuid;
            entities.AspNetRoles.Add(role);
            entities.SaveChanges();
            return(base.execute(entities));
        }
示例#3
0
        public override OperationResult execute(CimetEntities entities)
        {
            picture slika = new picture();

            slika.src        = this.Slika.Src;
            slika.picture_id = this.Slika.PictureId;
            slika.alt        = this.Slika.Alt;
            entities.picture.Add(slika);
            entities.SaveChanges();
            return(base.execute(entities));
        }
示例#4
0
        public override OperationResult execute(CimetEntities entities)
        {
            AspNetRoles role = entities.AspNetRoles.Where(r => r.Id == Role.Uuid).FirstOrDefault();

            if (role != null)
            {
                role.Name = Role.Name;
                entities.SaveChanges();
                return(base.execute(entities));
            }

            OperationResult result = new OperationResult();

            result.Status  = false;
            result.Message = "Uloga ne postoji.";
            return(result);
        }
示例#5
0
        public override OperationResult execute(CimetEntities entities)
        {
            IEnumerable <RecipesDto> ieRecepti =
                from recept in entities.recipes
                select new RecipesDto
            {
                Name = recept.name,
                Alt  = recept.picture.alt,
                Src  = recept.picture.src,
                Text = recept.text
            };

            OperationResult result = new OperationResult();

            result.Items  = ieRecepti.ToArray();
            result.Status = true;
            return(result);
        }
示例#6
0
        public override OperationResult execute(CimetEntities entities)
        {
            picture slika = entities.picture.Where(r => r.picture_id == Slika.PictureId).FirstOrDefault();

            if (slika != null)
            {
                slika.src = Slika.Src;
                slika.alt = Slika.Alt;
                entities.SaveChanges();
                return(base.execute(entities));
            }

            OperationResult result = new OperationResult();

            result.Status  = false;
            result.Message = "Slika ne postoji.";
            return(result);
        }
示例#7
0
        public override OperationResult execute(CimetEntities entities)
        {
            base.criteria.Id = Id;
            picture slika = entities.picture.Where(r => r.picture_id == Id).FirstOrDefault();

            if (slika != null)
            {
                entities.picture.Remove(slika);
                entities.SaveChanges();
                return(base.execute(entities));
            }
            else
            {
                OperationResult result = new OperationResult();
                result.Status  = false;
                result.Message = "Slika ne postoji !";
                return(result);
            }
        }
示例#8
0
      public override OperationResult execute(CimetEntities entities)
      {
          base.criteria.Uuid = Uuid;
          AspNetRoles role = entities.AspNetRoles.Where(r => r.Id == Uuid && r.AspNetUsers.Count() == 0).FirstOrDefault();

          if (role != null)
          {
              entities.AspNetRoles.Remove(role);
              entities.SaveChanges();
              return(base.execute(entities));
          }
          else
          {
              OperationResult result = new OperationResult();
              result.Status  = false;
              result.Message = "Uloga ne postoji ili sadrzi korisnike!";
              return(result);
          }
      }
示例#9
0
        public override OperationResult execute(CimetEntities entities)
        {
            GalleryDto dto = new GalleryDto();
            IEnumerable <PictureDto> iePictures =
                from galerija in entities.gallery
                select new PictureDto
            {
                Alt = galerija.picture.alt,
                Src = galerija.picture.src
            };

            dto.Pictures = iePictures.ToList();

            OperationResult result = new OperationResult();

            result.Status   = true;
            result.Items    = new BaseDto[1];
            result.Items[0] = dto;
            return(result);
        }
示例#10
0
        public override OperationResult execute(CimetEntities entities)
        {
            blog blog = new blog();

            blog.name         = this.BlogDto.Name;
            blog.text         = this.BlogDto.Text;
            blog.date_created = DateTime.Now;
            blog.user_id      = this.BlogDto.User_id;
            blog.picture_id   = this.BlogDto.Picture.PictureId;
            picture p = new picture
            {
                src = BlogDto.Picture.Src,
                alt = BlogDto.Picture.Alt
            };


            entities.blog.Add(blog);
            entities.SaveChanges();
            return(base.execute(entities));
        }
示例#11
0
        public override OperationResult execute(CimetEntities entities)
        {
            IEnumerable <AboutDto> ieAbout =
                from about in entities.about
                select new AboutDto
            {
                Alt  = about.picture.alt,
                Src  = about.picture.src,
                Text = about.text
            };



            OperationResult op = new OperationResult();

            op.Status = true;
            op.Items  = ieAbout.ToArray();
            //op.Items = new BaseDto[1];
            //op.Items[0] = ieAbout as AboutDto;
            return(op);
        }
示例#12
0
        public override OperationResult execute(CimetEntities entities)
        {
            SliderDto dto = new SliderDto();
            IEnumerable <PictureDto> iePictures =
                from slider in entities.slider
                select new PictureDto
            {
                Alt  = slider.picture.alt,
                Src  = slider.picture.src,
                Text = slider.text
            };

            dto.Pictures = iePictures.ToList();

            OperationResult result = new OperationResult();

            result.Status   = true;
            result.Items    = new BaseDto[1];
            result.Items[0] = dto;
            return(result);
        }
示例#13
0
        public override OperationResult execute(CimetEntities entities)
        {
            IEnumerable <BlogDto> ieBlog =
                from blog in entities.blog
                select new BlogDto
            {
                //Id=blog.Id,
                Name         = blog.name,
                Text         = blog.text,
                Date_created = blog.date_created,
                User_id      = blog.user_id,
                UserName     = blog.AspNetUsers.UserName,
                Picture_id   = blog.picture_id,
                Src          = blog.picture.src,
                Alt          = blog.picture.alt
            };

            OperationResult result = new OperationResult();

            result.Items  = ieBlog.ToArray();
            result.Status = true;
            return(result);
        }
示例#14
0
        public override OperationResult execute(CimetEntities entities)
        {
            IEnumerable <PictureDto> iePicture =
                from slika in entities.picture
                select new PictureDto
            {
                PictureId = slika.picture_id,
                Src       = slika.src,
                Alt       = slika.alt
            };

            //ovde prosirujemo upit
            if (!(criteria.Id < 0 || criteria.Id == 0 || criteria.Id == null))
            {
                iePicture = iePicture.Where(r => r.PictureId == criteria.Id);
            }


            OperationResult result = new OperationResult();

            result.Items  = iePicture.ToArray();
            result.Status = true;
            return(result);
        }
示例#15
0
 //protected virtual void checkData() { }
 public abstract OperationResult execute(CimetEntities entities);