Beispiel #1
0
        public async Task <ActionResult> Put([FromRoute]  string id, [FromBody] Person person)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            if (id != person.Id)
            {
                return(BadRequest());
            }
            try
            {
                await Repository.UpdatePersonAsync(id, person);
            }
            catch (DocumentClientException de)
            {
                if (de.StatusCode == System.Net.HttpStatusCode.NotFound)
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }
            catch (Exception)
            {
                throw;
            }

            return(Ok());
        }
Beispiel #2
0
        public async Task <ActionResult> EditAsync([Bind("Id, FirstName, MiddleName, Surname, Address, EmailAddresses")] Person person)
        {
            if (ModelState.IsValid)
            {
                await Respository.UpdatePersonAsync(person.Id, person);

                return(RedirectToAction("Index"));
            }

            return(View(person));
        }