Пример #1
0
 public bool SignatoryUpload(byte[] image, CustomerSignatureObj entity)
 {
     try
     {
         if (entity == null)
         {
             return(false);
         }
         var user     = _serverRequest.UserDataAsync().Result;
         var Category = _dataContext.deposit_customersignature.Where(a => a.SignatoryId == entity.SignatoryId && a.CustomerId == entity.CustomerId).FirstOrDefault();
         if (Category != null)
         {
             Category.SignatoryId  = entity.SignatoryId;
             Category.CustomerId   = entity.CustomerId;
             Category.Name         = entity.DocumentName;
             Category.SignatureImg = entity.SignatureImg;
             Category.Active       = true;
             Category.Deleted      = false;
             Category.CreatedBy    = user.UserName;
             Category.CreatedOn    = DateTime.Now;
             Category.UpdatedBy    = user.UserName;
             Category.UpdatedOn    = DateTime.Now;
         }
         else
         {
             var kk = new deposit_customersignature
             {
                 SignatureId  = entity.SignatureId,
                 SignatoryId  = entity.SignatoryId,
                 CustomerId   = entity.CustomerId,
                 Name         = entity.DocumentName,
                 SignatureImg = entity.SignatureImg,
                 Active       = true,
                 Deleted      = false,
                 CreatedBy    = user.UserName,
                 CreatedOn    = DateTime.Now,
                 UpdatedBy    = user.UserName,
                 UpdatedOn    = DateTime.Now,
             };
             _dataContext.deposit_customersignature.Add(kk);
         }
         var response = _dataContext.SaveChanges() > 0;
         return(response);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Пример #2
0
        public async Task <bool> AddUpdateSignatureAsync(deposit_customersignature model)
        {
            try
            {
                if (model.SignatureId > 0)
                {
                    var itemToUpdate = await _dataContext.deposit_customersignature.FindAsync(model.SignatureId);

                    _dataContext.Entry(itemToUpdate).CurrentValues.SetValues(model);
                }
                else
                {
                    await _dataContext.deposit_customersignature.AddAsync(model);
                }
                return(await _dataContext.SaveChangesAsync() > 0);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }