i have a view inside that i have two checkboxes On check i want save current assigned value inside database table
i have a table this is the model of this
public class RoomHk
{
public int RoomHkId { get; set; }
public int RoomId { get; set; }
public DateTime? DeepCleaning { get; set; }
public DateTime? NewLinen { get; set; }
}
this is the child table of my Room Table.Following is my view, suppose user check on first checkbox then he clicks on save button then i want to save current datetime in the New Linen column of the RoomHk table to that respective RoomId, How can i do it with jquery post method.
<div class="col-6">
@if (item.NewLinen == null)
{
<input type="checkbox" data-nlid="@item.RoomId" class="form-check-input newLinen" />
<label>New Linen</label>
<br />
}
@if (item.DeepCleaning == null)
{
<input type="checkbox" data-dcid="@item.RoomId" class="form-check-input deepClean" />
<label>Deep Cleaning</label>
}
</div>
<button type="button" class="btn btn-default insert" data-rid="@item.RoomId">Save</button>
$(function () {
$('.insert').click(function () {
$.post("@Url.Action("SetCleaningStatus", "HouseKeeping")", { id: $(this).data("id"), });
});
});
Aucun commentaire:
Enregistrer un commentaire