Beispiel #1
0
        public async Task <IActionResult> DeleteTask([FromBody] TaskModelView outSide)
        {
            if (outSide == null)
            {
                return(BadRequest());
            }

            try
            {
                var response = await AdminHttpClient.DeleteAsync(WebConfiguration.Instance.WebApiConfig, $"api/Task/{outSide.TaskId}", outSide, Request);

                return(Json(new { success = true }));
            }
            catch (Exception e)
            {
                return(BadRequest(e));
            }
        }
Beispiel #2
0
        public async Task <IActionResult> Edit(TaskModelView model)
        {
            if (ModelState.IsValid)
            {
                model.CreateDate = DateTime.UtcNow;
                model.AsaainTo   = currentUser.Id;
                var response = await AdminHttpClient.PostAsync(WebConfiguration.Instance.WebApiConfig, $"api/Task", model, Request);

                if (response.IsSuccessStatusCode)
                {
                    return(RedirectToAction("Index"));
                }
                else
                {
                    return(View(model));
                }
            }
            return(View(model));
        }