public IHttpActionResult Post(Member member)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(this.ModelState);
            }

            _repo.SaveMember(member);

            return Created("", member);
        }
Exemplo n.º 2
0
 public void SaveMember(Member memberToSave)
 {
     if (memberToSave.Id == 0)
     {
         _db.Members.Add(memberToSave);
         _db.SaveChanges();
     }
     else
     {
         var original = this.Find(memberToSave.Id);
         original.FirstName = memberToSave.FirstName;
         original.LastName = memberToSave.LastName;
         original.Email = memberToSave.Email;
         original.Phone = memberToSave.Phone;
         _db.SaveChanges();
     }
 }