public JsonResult AddPost(HomePost Post) { db.Configuration.ProxyCreationEnabled = false; var post = Post; post.DatePosted = DateTime.Now; db.Posts.Add(post); db.SaveChanges(); post.Person = db.People.FirstOrDefault(m => m.Id == Post.PersonId); return(Json(post, JsonRequestBehavior.AllowGet)); }
public Response Post(HomePost theModel) { List <BBDeviceProperties> UpdatedDevices = new List <BBDeviceProperties>(); if (theModel != null && theModel.IPAddress != null) { for (int i = 0; i < theModel.IPAddress.Length; i++) { UpdatedDevices.Add(new BBDeviceProperties { Guid = string.Empty, Name = theModel.Name[i], IP = theModel.IPAddress[i] }); } } Core.Instance.Update(UpdatedDevices.ToArray()); return(new Response { Location = Context.Request, StatusCode = System.Net.HttpStatusCode.Moved }); }