Ejemplo n.º 1
0
        public async Task <IActionResult> Edit(long importId, int page, [FromForm] DTO.LogRowMismatch entity)
        {
            try
            {
                string responseData = await ApiClientHelper.ExecutePostAsync($"{ApiClientHelper.LogRowMismatchesUrl}", JsonConvert.SerializeObject(entity, new JsonSerializerSettings
                {
                    DateFormatHandling = DateFormatHandling.MicrosoftDateFormat,
                    NullValueHandling  = NullValueHandling.Ignore
                }));

                bool converted = bool.Parse(responseData);
                messageType = (converted ? "success" : "warning");
                message     = $"Log row{ (converted ? "" : " not") } converted to Row.";
            }
            catch (Exception ex)
            {
                messageType = "error";
                message     = $"Something went wrong: {ex.Message}";
            }
            finally
            {
                ((Controller)this).DisplayTempData(messageType, message);
            }
            return(RedirectToAction("index", new { importId = importId, page = page }));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Create(int importId, [FromForm] DTO.LogRow logRow)
        {
            try
            {
                string responseData = await ApiClientHelper.ExecutePostAsync($"{ApiClientHelper.LogRowUrl}", JsonConvert.SerializeObject(logRow, new JsonSerializerSettings
                {
                    DateFormatHandling = DateFormatHandling.MicrosoftDateFormat,
                    NullValueHandling  = NullValueHandling.Ignore
                }));

                messageType = "success";
                message     = $"Log Row successfuly added!";
            }
            catch (Exception ex)
            {
                messageType = "error";
                message     = $"Something went wrong: {ex.Message}";
            }
            finally
            {
                ((Controller)this).DisplayTempData(messageType, message);
            }
            return(RedirectToAction("Index", new { importId = importId }));
        }