public ActionResult Novo() { ViewBag.TipoArquivo = GetTypeArchiveSelectListItem(new GaleriaService().GetTypeArchiveSelectListItem(), null); ViewBag.Galerias = GetGallerySelectListItem(new GaleriaService().GetAll(), null); var tempObj = new Galeria { IsAtivo = true, DataInclusao = DateTime.Now }; return View(tempObj); }
public JsonResult Editar(Galeria model, List<Arquivo> listaArquivos) { for (var i = 0; i < listaArquivos.Count; i++) { model.Arquivo.Add(listaArquivos[i]); } new GaleriaService().UpdateObject(model); return Json(new JsonRequestResult { ResultType = JsonRequestResultType.Success, Message = Constants._msgUpdateSuccess, ReturnUrl = Url.Content("~/Admin/Galeria/") }, JsonRequestBehavior.AllowGet); }
public ActionResult Novo(Galeria model, List<Arquivo> listaArquivos) { model.DataInclusao = DateTime.Now; for (var i = 0; i < listaArquivos.Count; i++) { listaArquivos[i].DataInclusao = DateTime.Now; model.Arquivo.Add(listaArquivos[i]); } new GaleriaService().InsertObject(model); return Json(new JsonRequestResult { ResultType = JsonRequestResultType.Success, Message = Constants._msgCreateSuccess, ReturnUrl = Url.Content("~/Admin/Galeria/") }); }
/// <summary> /// Attachments the process. /// </summary> /// <param name="tempFile">The temp file.</param> /// <param name="model">The model.</param> private static void AttachmentProcess(String tempFile, Galeria model) { if (model.Arquivo != null) { if (model.Arquivo.Any(pa => pa.CaminhoArquivo.ToLower() == tempFile.ToLower())) { // Update foreach (var item in model.Arquivo.Where(pa => pa.CaminhoArquivo.ToLower() == tempFile.ToLower())) { item.CaminhoArquivo = tempFile; } } else { // Insert model.Arquivo.Add(CreateAttachment(tempFile)); } } }
/// <summary> /// Deprecated Method for adding a new object to the Galeria EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToGaleria(Galeria galeria) { base.AddObject("Galeria", galeria); }
/// <summary> /// Create a new Galeria object. /// </summary> /// <param name="idGaleria">Initial value of the IdGaleria property.</param> /// <param name="nome">Initial value of the Nome property.</param> /// <param name="dataInclusao">Initial value of the DataInclusao property.</param> /// <param name="isAtivo">Initial value of the IsAtivo property.</param> public static Galeria CreateGaleria(global::System.Int32 idGaleria, global::System.String nome, global::System.DateTime dataInclusao, global::System.Boolean isAtivo) { Galeria galeria = new Galeria(); galeria.IdGaleria = idGaleria; galeria.Nome = nome; galeria.DataInclusao = dataInclusao; galeria.IsAtivo = isAtivo; return galeria; }