示例#1
0
        public async Task <IActionResult> Edit(PlaceInfoViewModel editPlace, long placeId)
        {
            if (ModelState.IsValid)
            {
                if (editPlace.File != null)
                {
                    var errors = imageService.Validate(editPlace.File, editPlace);
                    if (errors.Count != 0)
                    {
                        return(View(editPlace));
                    }
                    await placeService.EditPlaceAsync(placeId, editPlace);

                    await imageService.UploadAsync(editPlace.File, placeId.ToString(), "place");

                    await placeService.SetIndexImageAsync(placeId, "place");
                }
                return(RedirectToAction(nameof(PlaceController.MyPlace), "Place"));
            }

            return(View(editPlace));
        }