public override OperationResult Execute(skiiiEntities entities) { Category cat = new Category(); cat.name = this.Cat.Name; entities.Categories.Add(cat); entities.SaveChanges(); return(base.Execute(entities)); }
public override OperationResult Execute(skiiiEntities entities) { var contact = new Contact(); contact.idUser = this.DTO.Uuid; contact.message = this.DTO.message; entities.Contacts.Add(contact); entities.SaveChanges(); return(base.Execute(entities)); }
public override OperationResult Execute(skiiiEntities entities) { Category cat = entities.Categories.Where(r => r.idCategory == Cat.Id).FirstOrDefault(); if (cat != null) { cat.name = Cat.Name; entities.SaveChanges(); return(base.Execute(entities)); } OperationResult result = new OperationResult(); result.Status = false; result.Message = "Kategorija ne postoji"; return(result); }
public override OperationResult Execute(skiiiEntities entities) { Post postzabrisanje = entities.Posts.Where(p => p.idPost == idzabriranje).FirstOrDefault(); if (postzabrisanje != null) { entities.Posts.Remove(postzabrisanje); entities.SaveChanges(); return(base.Execute(entities)); } else { OperationResult result = new OperationResult(); result.Status = false; result.Message = "Doslo je do greske, post ne postoji u bazi."; return(result); } }
public override OperationResult Execute(skiiiEntities entities) { Category cat = entities.Categories.Where(p => p.idCategory == IdzaBrisanje).FirstOrDefault(); if (cat != null) { entities.Categories.Remove(cat); entities.SaveChanges(); return(base.Execute(entities)); } else { OperationResult result = new OperationResult(); result.Status = false; result.Message = "Doslo je do greske. Odredjeni postovi se nalaze u kategoriji"; return(result); } }
public override OperationResult Execute(skiiiEntities entities) { var slika = new Image(); slika.src = this.DTO.src; Post post = new Post(); post.Image = slika; post.heading = DTO.heading; post.idCategory = 4; post.idUser = DTO.Uuid; post.ImageAbout = DTO.ImageAbout; post.paragraph = DTO.paragraph; post.paragraph2 = DTO.paragraph2; post.Image = slika; entities.Images.Add(slika); entities.Posts.Add(post); entities.SaveChanges(); return(base.Execute(entities)); }