//public async Task<ActionResult> Index() public async Task <ActionResult> EditProduct([Bind(Include = "idProduct,idTransport,idEntertainment,idHotel,name,urlImage,price,discountRate,code,source_city,target_city,spectacle_date,arrival_date,departure_date,description,IdUser,EventDate")] Product product, string listTransport, string listEntertainment, string listHotel) { Response message = new UtilitiesProject.Response(); if (ModelState.IsValid) { try { long idTransport = 0; long idEntretiment = 0; long idHotel = 0; Int64.TryParse(listTransport, out idTransport); Int64.TryParse(listEntertainment, out idEntretiment); //Int32.TryParse(listHotel, out idHotel); product.idTransport = idTransport; product.idEntertainment = idEntretiment; Int64.TryParse(listHotel, out idHotel); product.idHotel = idHotel; ProductService productService = new ProductService(); message = await productService.EditProduct(product, Session["token"].ToString()); }catch (Exception exp) { log.Error("ProductController/EditProduct", exp); } } return(RedirectToAction("", "Product")); //return new JsonResult() //{ // JsonRequestBehavior = JsonRequestBehavior.AllowGet, // Data = message.Description //}; }
public async Task <ActionResult> CreateCampaign([Bind(Include = "idCampaign,name,idStateCampaign,urlImage,description,idProduct,startDate,endDate")] Campaign campaignz, string listStateCampaign) { long idStateCampaign = 0; Int64.TryParse(listStateCampaign, out idStateCampaign); campaignz.idStateCampaign = idStateCampaign; campaignz.idUser = 2; campaignz.modificationDate = DateTime.Now; Response message = new UtilitiesProject.Response(); CampaignService campaignService = new CampaignService(); if (ModelState.IsValid) { try { message = await campaignService.CreateCampaign(campaignz, Session["token"].ToString()); } catch (Exception exp) { log.Error("CampaignController/EditCampaign", exp); } } //return new JsonResult() //{ // JsonRequestBehavior = JsonRequestBehavior.AllowGet, // Data = new { success = true} //}; return(RedirectToAction("Index", "Campaign")); }