public ActionResult EditarPost(Post c, HttpPostedFileBase imagenSisi) { PostClient postClient = new PostClient(); if (imagenSisi != null && imagenSisi.ContentLength > 0) { byte[] imagenData = null; using (var bynaryImage = new BinaryReader(imagenSisi.InputStream)) { imagenData = bynaryImage.ReadBytes(imagenSisi.ContentLength); } c.Logo = imagenData; } else { var imagen = postClient.Get(c.Id); c.Logo = imagen.Logo; } if (c.NombreCategoria == 0) { return(EditarPost("Debes seleccionar una Categoria.")); } else if (c.NombrePais == 0 || c.NombreCiudad == 0) { return(EditarPost("Debes seleccionar un pais y su ciudad correspondiente.")); } else if (c.NombreTipoTrabajo == 0) { return(EditarPost("Debes seleccionar un tipo de Trabajo.")); } else { if (ModelState.IsValid) { postClient.Update(c); return(RedirectToAction("ProfileAcc")); } else { return(View(c)); } } }
public async Task <IActionResult> OnPost() { await _postClient.Update(Post); return(RedirectToPage("/index")); }