public ResponseModel GetUserInterest(UserInterestModel objModel) { var _result = _instance.GetUserInterest(objModel); return(new ResponseModel() { Response = JsonConvert.SerializeObject(_result), Success = true }); }
public ActionResult Select(int interestId, int?id) { var userModel = new UserInterestModel(); var userId = Guid.Parse(User.Identity.GetUserId()); userModel.UserId = userId; userModel.InterestId = interestId; var svc = CreateInterestService(); svc.AddInterest(userModel); return(View(userModel)); }
// public IHttpActionResult Registeration(RequestModel requestModel) public IHttpActionResult GetUserInterest(RequestModel requestModel) { var data = requestModel.Data; UserInterestModel objProductModel = JsonConvert.DeserializeObject <UserInterestModel>(data); var sendResponse = new ResponseModel() { Response = JsonConvert.SerializeObject(userServices.GetUserInterest(objProductModel)), Success = true }; var sendJson = Json(sendResponse); return(sendJson); }
public List <InterestModel> GetCateWiseInterestEdit() { UserInterestModel objModel = new UserInterestModel(); LoginModel MdUser = Services.GetLoginUser(this.ControllerContext.HttpContext, _JwtTokenManager); if (MdUser.Id != 0) { objModel.UserId = Convert.ToInt64(MdUser.Id); } var InterestList = new List <InterestModel>(); var _request = JsonConvert.SerializeObject(objModel); ResponseModel ObjResponse = CommonFile.GetApiResponse(Constant.ApiGetUserInterest, _request); InterestList = JsonConvert.DeserializeObject <List <InterestModel> >(ObjResponse.Response); return(InterestList); }
public bool AddInterest(UserInterestModel model) { //TODO: persist item from Interest var entity = new UserInterest() { UserId = _userId, InterestId = model.InterestId, }; using (var ctx = new ApplicationDbContext()) { ctx.UserInterests.Add(entity); return(ctx.SaveChanges() == 1); } }
public IHttpActionResult SaveUserInterest(RequestModel requestModel) { var data = JsonConvert.DeserializeObject(requestModel.Data); var xmlNode = JsonConvert.DeserializeXmlNode(data.ToString(), "root").OuterXml; // XNode node = JsonConvert.DeserializeXNode(data).outerxml; UserInterestModel objUserInterest = new UserInterestModel(); objUserInterest.XmlData = xmlNode; // UserInterestModel objUserInterest = JsonConvert.DeserializeObject<UserInterestModel>(data.ToString()); var sendResponse = new ResponseModel() { Response = JsonConvert.SerializeObject(userServices.SaveUserInterest(objUserInterest)), Success = true }; var sendJson = Json(sendResponse); return(sendJson); }
public ResponseModel SaveUserInterest(UserInterestModel objModel) { var _result = new SaveUserInterest_Result(); try { _result = _instance.SaveUserInterest(objModel); } catch (Exception ex) { String Exception = ex.ToString(); _result.Response = Exception; } return(new ResponseModel() { Response = _result.Response, Success = _result.Success.Value }); }
public ActionResult Select(UserInterestModel userModel) { if (!ModelState.IsValid) { return(View(userModel)); } var service = CreateInterestService(); if (service.AddInterest(userModel)) { TempData["SaveResult"] = "Your interest preference has been stored"; return(RedirectToAction("Index")); } ModelState.AddModelError("", "An error occured. Please try again."); return(RedirectToAction("Index")); }
public IEnumerable <GetUserInterest_Result> GetUserInterest(UserInterestModel objModel) { return(Context.GetUserInterest(objModel.UserId).ToList()); }
public SaveUserInterest_Result UpdateUserInterest(UserInterestModel objModel) { var Result = Context.SaveUserInterest(objModel.XmlData, objModel.Operation); return(Result.FirstOrDefault()); }