コード例 #1
0
        public IActionResult Edit(Guid id)
        {
            try
            {
                var model = baseDataService.GetByID(id);

                return(View(new BaseDataVM
                {
                    ID = model.ID,
                    CreateTime = DateTime.Now,
                    Icon = model.Icon,
                    IsDefault = Convert.ToBoolean(model.IsDefault),
                    Key = model.Key,
                    Type = model.Type,
                    UpdateTime = DateTime.Now,
                    Value = model.Value,
                    IconData = ImgToBase64String(model.Icon)
                }));
            }
            catch (Exception ex)
            {
                TempData["error"] = ex.Message;
            }

            return(RedirectToAction("Index", "BaseData"));
        }