public JsonResult Save(string jsonModel, string button) { CommanResponse commanResponse = new CommanResponse(); try { // Deserializing json model to object TacticCampaignViewModel model = new JavaScriptSerializer().Deserialize <TacticCampaignViewModel>(jsonModel); TacticCampaign tacticCampaign = new TacticCampaign(); if (button == "Save Draft") { if (model.Id == 0) // insert new record as draft { model.Status = Status.Draft.ToString(); tacticCampaign = _tacticCampaignServices.InsertTacticCampaign(model); } else { model.Status = Status.Draft.ToString(); tacticCampaign = _tacticCampaignServices.Update(model); } commanResponse.Status = true; } else { if (isValid(model)) { if (model.Id == 0) { model.Status = Status.Complete.ToString(); tacticCampaign = _tacticCampaignServices.InsertTacticCampaign(model); } else { model.Status = Status.Complete.ToString(); tacticCampaign = _tacticCampaignServices.Update(model); } commanResponse.Status = true; } } commanResponse.Result = tacticCampaign.Id; } catch (Exception ex) { commanResponse.Status = false; commanResponse.Message = ex.Message; } return(Json(commanResponse, JsonRequestBehavior.AllowGet)); }
public JsonResult GetDigitalTouchpoint(int tacticId) { CommanResponse commanResponse = new CommanResponse(); try { commanResponse.Result = _digitalTouchpoint.GetbyId(tacticId); commanResponse.Status = true; } catch (Exception ex) { commanResponse.Status = false; commanResponse.Message = ex.Message; } return(Json(commanResponse, JsonRequestBehavior.AllowGet)); }
public JsonResult AddDigitalTouchPoint(List <DigitalTouchPointViewModel> model) { CommanResponse commanResponse = new CommanResponse(); try { commanResponse.Status = true; commanResponse.Result = _digitalTouchpoint.Insert(model); commanResponse.Message = "Added Successfully"; } catch (Exception ex) { commanResponse.Status = false; commanResponse.Message = ex.Message; } return(Json(commanResponse, JsonRequestBehavior.AllowGet)); }
public JsonResult DeleteSingleDigitalPoint(int digitalId, int tacticId) { CommanResponse commanResponse = new CommanResponse(); try { commanResponse.Status = true; _digitalTouchpoint.DeleteSingleDigitalPoint(digitalId); commanResponse.Result = _digitalTouchpoint.GetbyId(tacticId); commanResponse.Message = "Deleted Successfully"; } catch (Exception ex) { commanResponse.Status = false; commanResponse.Message = ex.Message; } return(Json(commanResponse, JsonRequestBehavior.AllowGet)); }