Ejemplo n.º 1
0
        public bool SaveCancelUser(TaxiAppzDBContext context, CancelUserInfo cancelUserInfo, LoggedInUser loggedInUser)
        {
            var roleExist = context.TabZonetypeRelationship.FirstOrDefault(t => t.IsDelete == 0 && t.Zonetypeid == cancelUserInfo.Zonetypeid);

            if (roleExist == null)
            {
                throw new DataValidationException($"Zone type does not exists");
            }

            TabUserCancellation tabUserCancellation = new TabUserCancellation();

            tabUserCancellation.Arrivalstatus             = cancelUserInfo.ArrivalStatus;
            tabUserCancellation.CancellationReasonArabic  = cancelUserInfo.CancelReasonArabic;
            tabUserCancellation.CancellationReasonEnglish = cancelUserInfo.CancelReasonEnglish;
            tabUserCancellation.CancellationReasonSpanish = cancelUserInfo.CancelReasonSpanish;
            tabUserCancellation.Paymentstatus             = cancelUserInfo.PaymentStatus;
            tabUserCancellation.Zonetypeid = cancelUserInfo.Zonetypeid;

            tabUserCancellation.CreatedAt = tabUserCancellation.UpdatedAt = TimeZoneInfo.ConvertTimeToUtc(DateTime.Now);
            tabUserCancellation.CreatedBy = tabUserCancellation.UpdatedBy = loggedInUser.Email;
            tabUserCancellation.IsDelete  = false;
            tabUserCancellation.IsActive  = true;
            context.Add(tabUserCancellation);
            context.SaveChanges();
            return(true);
        }