// Delete row in BadgeRecieved public void Delete(BadgeHistory b) { using (IDbConnection db = CreateConnection()) { db.Execute("DELETE person WHERE TransactionNum = @TransactionNum", b); } }
// Create new row in BadgeHistory public void Create(BadgeHistory b) { using (IDbConnection db = CreateConnection()) { db.Execute("INSERT INTO [BadgeHistory] VALUES(@BadgeId, @GiverId, @StudentId, @TimeStamp, @Comment)", b); } }
// Update row in BadgeHistory public void Update(BadgeHistory b) { using (IDbConnection db = CreateConnection()) { db.Execute("UPDATE [BadgeHistory] SET [TransactionNum] = @TransactionNum, [BadgeId] = @BadgeId, [GiverId] = @GiverId, [StudentId] = @StudentId, [TimeStamp] = @TimeStamp, [Comment] = @Comment WHERE [TransactionNum] = @TransactionNum", b); } }
public ActionResult GiveBadge(BadgeHistory b) { var service = new GstService(SystemContext.GstConnectionString); b.TimeStamp = DateTime.Now; var badge = service.ReadSingleBadge(b.BadgeId); var giver = service.ReadSinglePerson(b.GiverId); if (ModelState.IsValid) { service.Create(b); return(RedirectToAction("GridView")); } return(View(b)); }
/// <summary> /// Converts this instance of <see cref="BadgeHistory"/> to an instance of <see cref="BadgeHistoryDTO"/>. /// </summary> /// <param name="entity"><see cref="BadgeHistory"/> to convert.</param> public static BadgeHistoryDTO ToDTO(this BadgeHistory entity) { if (entity == null) { return(null); } var dto = new BadgeHistoryDTO(); dto.ID = entity.ID; dto.BadgeID = entity.BadgeID; dto.Number = entity.Number; dto.IsActive = entity.IsActive; dto.ModifiedByUserID = entity.ModifiedByUserID; dto.ModifiedDate = entity.ModifiedDate; dto.AuditDate = entity.AuditDate; entity.OnDTO(dto); return(dto); }
/// <summary> /// Converts this instance of <see cref="BadgeHistoryDTO"/> to an instance of <see cref="BadgeHistory"/>. /// </summary> /// <param name="dto"><see cref="BadgeHistoryDTO"/> to convert.</param> public static BadgeHistory ToEntity(this BadgeHistoryDTO dto) { if (dto == null) { return(null); } var entity = new BadgeHistory(); entity.ID = dto.ID; entity.BadgeID = dto.BadgeID; entity.Number = dto.Number; entity.IsActive = dto.IsActive; entity.ModifiedByUserID = dto.ModifiedByUserID; entity.ModifiedDate = dto.ModifiedDate; entity.AuditDate = dto.AuditDate; dto.OnEntity(entity); return(entity); }
/// <summary> /// Invoked when <see cref="ToEntity"/> operation is about to return. /// </summary> /// <param name="entity"><see cref="BadgeHistory"/> converted from <see cref="BadgeHistoryDTO"/>.</param> static partial void OnEntity(this BadgeHistoryDTO dto, BadgeHistory entity);
/// <summary> /// Invoked when <see cref="ToDTO"/> operation is about to return. /// </summary> /// <param name="dto"><see cref="BadgeHistoryDTO"/> converted from <see cref="BadgeHistory"/>.</param> static partial void OnDTO(this BadgeHistory entity, BadgeHistoryDTO dto);