public async Task <IActionResult> SmartxRelatedEdit(SmartXRelated model) { if (ModelState.IsValid) { model.Name = User.Identity.Name; try { if (model.Id == 0) { model.DateTime = DateTime.Now; await _smartXRelatedService.AddSmartXRelated(model); TempData["SuccessMsg"] = "저장되었습니다."; return(RedirectToAction("SmartxRelated")); } else { model.DateTime = DateTime.Now; await _smartXRelatedService.UpdateSmartXRelated(model); TempData["SuccessMsg"] = "저장되었습니다."; return(RedirectToAction("SmartxRelated")); } } catch (Exception ex) { TempData["ErrorMsg"] = ex.Message; } } return(View(model)); }