Example #1
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            UpdateTypeResponse response = new UpdateTypeResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("type", targetDepth))
                {
                    var unmarshaller = TypeUnmarshaller.Instance;
                    response.Type = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }
Example #2
0
        public UpdateTypeResponse Update(UpdateTypeRequest request)
        {
            var response = new UpdateTypeResponse();

            try
            {
                var type = request.MapTo <Data.Entities.Type>();
                DataContext.Types.Attach(type);
                DataContext.Entry(type).State = EntityState.Modified;
                DataContext.SaveChanges();
                response.IsSuccess = true;
                response.Message   = "KPI Type item has been updated successfully";
            }
            catch (DbUpdateException dbUpdateException)
            {
                response.Message = dbUpdateException.Message;
            }

            return(response);
        }
Example #3
0
        public UpdateTypeResponse Update(UpdateTypeRequest request)
        {
            var response = new UpdateTypeResponse();
            try
            {
                var type = request.MapTo<Data.Entities.Type>();
                DataContext.Types.Attach(type);
                DataContext.Entry(type).State = EntityState.Modified;
                DataContext.SaveChanges();
                response.IsSuccess = true;
                response.Message = "KPI Type item has been updated successfully";
            }
            catch (DbUpdateException dbUpdateException)
            {
                response.Message = dbUpdateException.Message;
            }

            return response;
        }