public bool BorrarProductoCarrito(int productoID, int carritoID) { bool respuesta = false; CarritoProducto obj = (from x in contexto.CarritoProducto where x.ProductoID == productoID && x.CarritoID == carritoID select x). FirstOrDefault <CarritoProducto>(); if (obj != null) { repository.Delete <CarritoProducto>(obj); respuesta = true; } return(respuesta); }
public async Task <IActionResult> LikeUser(int userId, int recipientId) { if (userId != int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value)) { return(Unauthorized()); } var like = await _usersService.GetLike(userId, recipientId); if (like != null) { _genericsRepo.Delete(like); } if (await _genericsRepo.SaveAll()) { return(BadRequest("Ai șters utilizatorul din lista de prieteni!")); } if (await _usersService.GetUser(recipientId) == null) { return(NotFound()); } _usersService.AddLike(userId, recipientId, like); if (await _genericsRepo.SaveAll()) { return(Ok()); } return(BadRequest("Failed to like user!")); }
public async Task <IActionResult> DeleteLaboratory(Laboratory laboratory) { _genericsRepo.Delete(laboratory); if (await _genericsRepo.SaveAll()) { return(NoContent()); } return(BadRequest("Delete Failed!")); }
public async Task <IActionResult> DeleteSeminar(Seminar seminar) { _genericsRepo.Delete(seminar); if (await _genericsRepo.SaveAll()) { return(NoContent()); } return(BadRequest("Delete Failed!")); }
public async Task <IActionResult> DeleteSubGroup(SubGroup subGroup) { _genericsRepo.Delete(subGroup); if (await _genericsRepo.SaveAll()) { return(NoContent()); } return(BadRequest("Delete Failed!")); }
public async Task <IActionResult> DeleteSpecialization(Specialization specialization) { _genericsRepo.Delete(specialization); if (await _genericsRepo.SaveAll()) { return(NoContent()); } return(BadRequest("Delete Failed!")); }
public async Task <IActionResult> DeletePresentation(CompanyPresentation presentation) { _genericsRepo.Delete(presentation); if (await _genericsRepo.SaveAll()) { return(NoContent()); } return(BadRequest("Delete Failed!")); }
public void DeletePhoto(Photo photo) { if (photo.PublicID != null) { var deleteParams = new DeletionParams(photo.PublicID); var result = _cloudinary.Destroy(deleteParams); if (result.Result == "ok") { _genericsRepo.Delete(photo); } if (photo.PublicID == null) { _genericsRepo.Delete(photo); } } }
public async Task <IActionResult> DeleteCourse(Course course) { _genericsRepo.Delete(course); if (await _genericsRepo.SaveAll()) { return(NoContent()); } return(BadRequest("Delete Failed!")); }
public Carrito DeleteCarrito(CarritoDTOs carrito) { var entity = new Carrito { CarritoID = carrito.CarritoID }; _repository.Delete <Carrito>(entity); return(entity); }
public async Task <IActionResult> DeletePost(Post post) { if (post.UserId != int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value) && User.FindFirst(ClaimTypes.Role).Value != "Admin") { return(Unauthorized()); } _genericsRepo.Delete(post); if (await _genericsRepo.SaveAll()) { return(NoContent()); } return(BadRequest("Delete Failed!")); }
public async Task <IActionResult> DeleteComment(Comment comment) { if (comment.UserId != int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value)) { return(Unauthorized()); } _genericsRepo.Delete(comment); if (await _genericsRepo.SaveAll()) { return(NoContent()); } return(BadRequest("Delete Failed!")); }
public bool DeleteMercaderia(int id) { Mercaderia mercaderia = _repository.Exists <Mercaderia>(id); if (mercaderia == null) { return(false); } else { _repository.Delete <Mercaderia>(mercaderia); return(true); } }
public Producto EliminarProducto(ProductoDto producto) { var entity = new Producto() { CategoriaID = producto.CategoriaID, Nombre = producto.Nombre, Descripcion = producto.Descripcion, PrecioID = producto.PrecioID, ImagenID = producto.ImagenID, MarcaID = producto.MarcaID, Stock = producto.Stock }; repository.Delete <Producto>(entity); return(entity); }
public void DeleteMessage(Message message) { _genericsRepo.Delete(message); }
public virtual void Delete(E entity) { Repository.Delete(entity); }
public void DeleteClass(int id) { var classToDelete = _classesRepo.GetClassById(id).Result; _genericsRepo.Delete(classToDelete); }