public Response Create(ShareParam param)
        {
            Response response = new Response();

            try
            {
                response.Text   = "This entity has been added :" + Environment.NewLine + JsonConverter.JsonConverter.ObjToJson(Processor.Create(param));
                response.Result = true;
            }
            catch
            {
                response.Text   = "Unfortunately something went wrong. Are you sure that the entity you are trying to create doesn't already exist ?";
                response.Result = false;
            }
            return(response);
        }
        public Response Update(long id, ShareParam param)
        {
            Response response = new Response();

            try
            {
                Processor.Update(id, param);
                response.Text   = "The entity has been updated.";
                response.Result = true;
            }
            catch
            {
                response.Text   = "The command was unable to execute. Are you sure the entity you want to update exists.";
                response.Result = false;
            }
            return(response);
        }
Exemple #3
0
        internal IntPtr ConnectCard(Reader reader, ShareParam shared, Protocol protocol)
        {
            IntPtr hCard = IntPtr.Zero;

            IntPtr activeProtocol = IntPtr.Zero;

            ErrorCode ret;

            lock (pcscApiLock)
            {
                ret = (ErrorCode)SCardConnect(context, reader.Name, (uint)shared, (uint)protocol, ref hCard, ref activeProtocol);
            }

            if (ret != ErrorCode.NoError)
            {
                throw new NFCException("Can not connect card:" + ret);
            }

            return(hCard);
        }
 public void Update(long id, ShareParam param)
 {
     Data.Entity.Share oldEntity = Dao.Find(id);
     Data.Entity.Share newEntity = ParamConverter.Convert(param, oldEntity);
     Dao.Update(newEntity);
 }
 public ShareResult Create(ShareParam param)
 {
     Data.Entity.Share entity = ParamConverter.Convert(param, null);
     entity = Dao.Save(entity);
     return(ResultConverter.Convert(entity));
 }
 public void ValidateParameters(ShareParam param)
 {
     throw new NotImplementedException();
 }