public JsonResult Create(ViewCenters Model) { try { using (CentersServiceClient client = new CentersServiceClient()) { Model.UpgradeDate = Model.CreateDate = DateTime.Now; Model.CenterName = Request.Form["CenterName"].ToString(); Model.CenterAddress = ""; Model.DistrictID = Convert.ToInt32(Request.Form["ddlDistrictID"]); Model.CityID = Convert.ToInt32(Request.Form["ddlCityID"]); Model.ProvinceID = Convert.ToInt32(Request.Form["ddlProvinceID"]); Model.CountryID = Convert.ToInt32(Request.Form["ddlCountryID"]); Model.CenterType = "1"; Model.CenterBanner = ""; Model.CenterIntrodition = ""; Model.CenterPortraint = ""; Model.Uid = user.Uid.ToString(); Model.OpenTime = DateTime.Now.ToString("yyyy-MM-dd "); Model.CloseTime = DateTime.Now.ToString("yyyy-MM-dd "); client.Add(Model); } return(Json(new { code = 0 })); } catch (Exception ex) { return(Json(new { code = ex.Message })); } }
public ActionResult CreateCenter(ViewCenters Model) { try { using (CentersServiceClient client = new CentersServiceClient()) { Model.CenterName = Request.Form["CenterName"].ToString(); Model.CenterState = 2; Model.CenterSource = 2; Model.CenterAddress = ""; Model.UpgradeDate = Model.CreateDate = DateTime.Now; Model.DistrictID = 0; Model.CityID = 0; Model.ProvinceID = 0; Model.CountryID = 0; Model.CenterType = ""; Model.CenterBanner = ""; Model.CenterIntrodition = ""; Model.CenterPortraint = ""; string temptypeid = ""; string[] arrtypeid = temptypeid.Split(','); string newtypeid = string.Empty; for (int i = 0; i < arrtypeid.Length; i++) { if (!String.IsNullOrEmpty(arrtypeid[i])) { arrtypeid[i] = "|" + arrtypeid[i] + "|"; newtypeid += arrtypeid[i] + ","; } } Model.YogaTypeid = newtypeid; Model.OpenTime = DateTime.Now.ToString("yyyy-MM-dd "); Model.CloseTime = DateTime.Now.ToString("yyyy-MM-dd "); client.Add(Model); return(Json(Model)); } } catch (Exception ex) { throw ex; } }
public ActionResult Create(ViewCenters Model) { try { using (CentersServiceClient client = new CentersServiceClient()) { Model.CenterName = Request.Form["CenterName"].ToString(); Model.CenterAddress = Request.Form["CenterAddress"].ToString(); Model.UpgradeDate = Model.CreateDate = DateTime.Now; Model.DistrictID = Convert.ToInt32(Request.Form["ddlDistrictID"]); Model.CityID = Convert.ToInt32(Request.Form["ddlCityID"]); Model.ProvinceID = Convert.ToInt32(Request.Form["ddlProvinceID"]); Model.CountryID = Convert.ToInt32(Request.Form["ddlCountryID"]); Model.CenterType = Request.Form["CenterType"]; Model.CenterBanner = Request.Form["CenterBanner"]; Model.CenterIntrodition = Request.Form["CenterIntrodition"]; Model.CenterPortraint = Request.Form["CenterPortraint"]; string temptypeid = Request.Form["hYogaTypeid"].ToString().TrimEnd(',') == "" ? Request.Form["YogaTypeid"].ToString().TrimEnd(',') : Request.Form["hYogaTypeid"].ToString().TrimEnd(','); string[] arrtypeid = temptypeid.Split(','); string newtypeid = string.Empty; for (int i = 0; i < arrtypeid.Length; i++) { if (!String.IsNullOrEmpty(arrtypeid[i])) { arrtypeid[i] = "|" + arrtypeid[i] + "|"; newtypeid += arrtypeid[i] + ","; } } Model.YogaTypeid = newtypeid; string opentime = Request.Form["OpenTime"]; string closetime = Request.Form["CloseTime"]; Model.OpenTime = DateTime.Now.ToString("yyyy-MM-dd ") + opentime; Model.CloseTime = DateTime.Now.ToString("yyyy-MM-dd ") + closetime; client.Add(Model); } return(RedirectToAction("Index", new { centertype = Request.Form["CenterType"] })); } catch (Exception ex) { throw ex; } }