Esempio n. 1
0
 public IHttpActionResult Save(DriverManufacturerDTO manufacturer)
 {
     try
     {
         var result = new ManufacturerBO().Save(manufacturer);
         return(Ok(result));
     }
     catch (Exception ex)
     {
         return(InternalServerError(ex));
     }
 }
        public async Task <string> Save(DriverManufacturerDTO manufacturer)
        {
            IRestClient client  = new RestClient(ApiBaseUrl);
            var         request = p_request;

            request.Method   = Method.POST;
            request.Resource = "master/manufacturer/save";
            request.AddJsonBody(manufacturer);

            return(ServiceResponse(
                       await client.ExecuteTaskAsync(request)));
        }
Esempio n. 3
0
        public bool Save(DriverManufacturerDTO manufacturer)
        {
            var result = false;

            if (currentTransaction == null)
            {
                connection = db.CreateConnection();
                connection.Open();
            }

            var transaction = (currentTransaction == null ? connection.BeginTransaction() : currentTransaction);

            try
            {
                var saveCommand = db.GetStoredProcCommand(DBRoutine.SAVEMANUFACTURER);

                db.AddInParameter(saveCommand, "Manufacturer", System.Data.DbType.String, manufacturer.Manufacturer);
                db.AddInParameter(saveCommand, "MakeType", System.Data.DbType.String, manufacturer.MakeType);
                db.AddInParameter(saveCommand, "Capacity", System.Data.DbType.Decimal, manufacturer.Capacity);

                result = Convert.ToBoolean(db.ExecuteNonQuery(saveCommand, transaction));
                if (currentTransaction == null)
                {
                    transaction.Commit();
                }
            }
            catch (Exception ex)
            {
                if (currentTransaction == null)
                {
                    transaction.Rollback();
                }

                throw ex;
            }
            finally
            {
                transaction.Dispose();
                connection.Close();
            }
            return(result);
        }
Esempio n. 4
0
 public bool Save(DriverManufacturerDTO manufacturer)
 {
     return(manufacturerDAL.Save(manufacturer));
 }
Esempio n. 5
0
        public async Task <ActionResult> Add(DriverManufacturerDTO manufactur)
        {
            var result = await new ManufacturerService(AUTHTOKEN, p_mobileNo).Save(manufactur);

            return(View("Add"));
        }