Example #1
0
        // Public Reservation Logic

        public static async Task <bool> PublicCreate(Models.Reservations.Reservation reservation, string departmentCode)
        {
            using (var db = new DataAccess.CaraxEntitiy())
            {
                reservation.CreatedDateTime = DateTime.Now;
                reservation.CreatedBy       = departmentCode;
                reservation.DepartmentCode  = departmentCode;
                reservation.CompanyCode     = reservation.CompanyCode;

                await db.Reservations.AddAsync(reservation);

                return(await db.SaveChangesAsync() > 0);
            }
        }
Example #2
0
        public static async Task <bool> Update(Guid token, Models.Reservations.Reservation reservation)
        {
            var userInfo = AuthenticationLogic.CheckTokenInfo(token);

            using (var db = new DataAccess.CaraxEntitiy())
            {
                reservation.UpdatedDateTime = DateTime.Now;
                reservation.UpdatedBy       = userInfo.Username;
                reservation.DepartmentCode  = userInfo.DepartmentCode;
                reservation.CompanyCode     = userInfo.CompanyCode;

                db.Reservations.Update(reservation);
                return(await db.SaveChangesAsync() > 0);
            }
        }