Beispiel #1
0
        public IActionResult SendNotifiWhislistAvailable()
        {
            List <NotificationWishListOutput> OutPutData = new List <NotificationWishListOutput>();
            NotificationWishListInput         filter     = new NotificationWishListInput();

            filter.UserID = Guid.Parse(HttpContext.Session.GetString(SessionKeyID));
            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(BaseAPI + "Site/");
                var responseTask = client.PostAsJsonAsync <NotificationWishListInput>("SendNotifiWhislistAvailable", filter);
                responseTask.Wait();

                var result = responseTask.Result;
                if (result.IsSuccessStatusCode)
                {
                    var content = result.Content.ReadAsStringAsync();
                    NotificationWishListResponseModel resutl = Newtonsoft.Json.JsonConvert.DeserializeObject <NotificationWishListResponseModel>(content.Result);
                    OutPutData = resutl.data;
                }
                else                 //web api sent error response
                {
                    //log response status here..
                    ModelState.AddModelError(string.Empty, "Terjadi kesalahan. Mohon hubungi admin.");
                }
            }
            return(Json(OutPutData));
        }
Beispiel #2
0
        public ActionResult <NotificationWishListResponseModel> SendNotifiWhislistAvailable([FromBody] NotificationWishListInput data)
        {
            NotificationWishListResponseModel res = new NotificationWishListResponseModel();

            try
            {
                WishListBL bl   = new WishListBL(DbContext);
                var        temp = bl.FindWishListAvailable(data.UserID);
                res.data = temp;

                res.Message  = "Success";
                res.Response = true;

                return(res);
            }
            catch (Exception ex)
            {
                res.Message  = ex.Message;
                res.Response = false;

                return(res);
            }
        }