public void DeleteCard(int CardId) { Htl_Cards comm = entities.Htl_Cards.Where(u => u.CardId == CardId).FirstOrDefault(); Htl_Cards datatodelete = entities.Htl_Cards.FirstOrDefault(m => m.CardId == comm.CardId); entities.DeleteObject(datatodelete); entities.SaveChanges(); }
public void UpdateCardToSoldStatus(CardViewModel modeltosave) { Htl_Cards comm = entities.Htl_Cards.Where(u => u.CardId == modeltosave.CardId).FirstOrDefault(); comm.CardId = modeltosave.CardId; comm.CardStatusId = modeltosave.CardStatusId; entities.ApplyCurrentValues(comm.EntityKey.EntitySetName, comm); entities.SaveChanges(); }
public bool CheckDuplicateCardNumber(string CardNumber) { Htl_Cards Cards = entities.Htl_Cards.Where(ii => ii.CardNumber == CardNumber).FirstOrDefault(); if (Cards != null) { return(false); } else { return(true); } }
public void CreateIssueCard(CardViewModel model) { Htl_Cards obj = new Htl_Cards { CardId = model.HFCardId, CardStatusId = model.CardStatusId, UpdatedBy = model.UpdatedBy, UpdatedDate = model.UpdatedDate, }; entities.ApplyCurrentValues(obj.EntityKey.EntitySetName, obj); entities.SaveChanges(); }
public void UpdateCardStatus(CardViewModel modeltosave) { Htl_Cards comm = entities.Htl_Cards.Where(u => u.CardId == modeltosave.HFCardId).FirstOrDefault(); comm.CardId = modeltosave.HFCardId; comm.CardNumber = modeltosave.CardNumber; comm.CardTypeId = modeltosave.CardTypeId; comm.CardValue = modeltosave.CardValue; comm.isActive = modeltosave.isActive; comm.ValidTill = modeltosave.ValidTill; comm.CardStatusId = modeltosave.CardStatusId; entities.ApplyCurrentValues(comm.EntityKey.EntitySetName, comm); entities.SaveChanges(); ///// }
public void CreateCard(CardViewModel model) { Htl_Cards obj = new Htl_Cards { CardNumber = model.CardNumber, CardStatusId = model.CardStatusId, ValidTill = model.ValidTill, CardTypeId = model.CardTypeId, CardValue = model.CardValue, isActive = model.isActive, CreatedBy = model.CreatedBy, CreatedDate = DateTime.Now, CardRule = model.CardRule, }; entities.AddToHtl_Cards(obj); entities.SaveChanges(); }
public int GetCardIdByCardNumber(string CardNumber) { Htl_Cards comm = entities.Htl_Cards.Where(u => u.CardNumber == CardNumber).FirstOrDefault(); return(comm.CardId); }