public async Task <IHttpActionResult> PostIntimacy(Intimacy intimacy) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Intimacies.Add(intimacy); try { await db.SaveChangesAsync(); } catch (DbUpdateException) { if (IntimacyExists(intimacy.UserID1)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = intimacy.UserID1 }, intimacy)); }
public async Task <IHttpActionResult> PutIntimacy(string id, Intimacy intimacy) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != intimacy.UserID1) { return(BadRequest()); } db.Entry(intimacy).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!IntimacyExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult Edit(Intimacy model) { //validate that list stays in the same place //id#1 when edit gets moved to the bottom of list var confirmEdit = _repo.UpdateIntimacy(model); return(RedirectToAction("List")); }
public void LoadIntimacy(Intimacy i) { intimacy = i; nameField.text = intimacy.Name; contextField.text = intimacy.Context; intensityDropdown.value = (int)intimacy.Intensity; intensityDropdown.RefreshShownValue(); }
public void AddIntimacy(Intimacy i) { if (!intimacies.Contains(i)) { intimacies.Add(i); } //handle new intimacy }
public bool DeleteIntimacy(int intimacyId) { Intimacy intimacy = GetIntimacyById(intimacyId); if (intimacy != null) { _ctx.Entry(intimacy).State = System.Data.Entity.EntityState.Deleted; _ctx.SaveChanges(); } return(true); }
public async Task <IHttpActionResult> GetIntimacy(string id) { Intimacy intimacy = await db.Intimacies.FindAsync(id); if (intimacy == null) { return(NotFound()); } return(Ok(intimacy)); }
public void AddNewIntimacy() { GameObject newIntimacyUI = Instantiate(IntimacyPrefab); newIntimacyUI.transform.SetParent(IntimacyHolder.transform); IntimacyUI intUI = newIntimacyUI.GetComponent <IntimacyUI> (); Intimacy newIntimacy = new Intimacy(); intUI.intimacy = newIntimacy; //characterManager.character.AddIntimacy (newIntimacy); intUI.AddCallbacks(); }
public int AddIntimacy(Intimacy intimacy) { if (_intimacies.Count <= 0) { intimacy.IntimacyId = 1; } else { intimacy.IntimacyId = _intimacies.Max(c => c.IntimacyId) + 1; } _intimacies.Add(intimacy); return(intimacy.IntimacyId); }
public async Task <IHttpActionResult> DeleteIntimacy(string id) { Intimacy intimacy = await db.Intimacies.FindAsync(id); if (intimacy == null) { return(NotFound()); } db.Intimacies.Remove(intimacy); await db.SaveChangesAsync(); return(Ok(intimacy)); }
public ActionResult Delete(Intimacy model) { var confirmDelete = _repo.DeleteIntimacy(model.IntimacyId); return(RedirectToAction("List")); }
public ActionResult Add(Intimacy model) { _repo.AddIntimacy(model); return(RedirectToAction("List")); }
public bool UpdateIntimacy(Intimacy intimacy) { _ctx.Entry(intimacy).State = System.Data.Entity.EntityState.Modified; _ctx.SaveChanges(); return(true); }
public int AddIntimacy(Intimacy intimacy) { _ctx.Intimacies.Add(intimacy); _ctx.SaveChanges(); return(_ctx.Intimacies.Max(i => i.IntimacyId)); }
public bool UpdateIntimacy(Intimacy intimacy) { _intimacies.RemoveAll(i => i.IntimacyId == intimacy.IntimacyId); _intimacies.Add(intimacy); return(true); }