public IHttpActionResult PutWings_RoomTypes(int id, Wings_RoomTypes wings_RoomTypes) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != wings_RoomTypes.Id) { return BadRequest(); } try { _Wings_RoomTypesService.Update(wings_RoomTypes); } catch (DbUpdateConcurrencyException) { if (!_Wings_RoomTypesService.Exists(id) ) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public IHttpActionResult PostWings_RoomTypes(Wings_RoomTypes wings_RoomTypes) { if (!ModelState.IsValid) { return BadRequest(ModelState); } _Wings_RoomTypesService.Create(wings_RoomTypes); return CreatedAtRoute("DefaultApi", new { id = wings_RoomTypes.Id }, wings_RoomTypes); }
public ActionResult SaveMatrix(FormCollection formCollection) { foreach (var key in formCollection.AllKeys) { var value = formCollection[key]; if (key.Contains("roomquantity_")) { Wings_RoomTypes wingrooms = new Wings_RoomTypes(); string[] arrvalues = key.Split('_'); wingrooms.WingsId = int.Parse(arrvalues[1]); wingrooms.RoomTypeId = int.Parse(arrvalues[2]); wingrooms.RoomType_Quantity = int.Parse(value); if (arrvalues.Length == 4) { wingrooms.Id = int.Parse(arrvalues[3]); _Wings_RoomTypesRepository.Update(wingrooms, wingrooms.Id.ToString ()); } else _Wings_RoomTypesRepository.Create(wingrooms); } } return RedirectToAction("Index"); }