public static string GetCollaboratorType(CollaboratorType collaboratorType)
        {
            var name = Enum.GetName(typeof(CollaboratorType), collaboratorType)
                       .ToLower();

            return(name);
        }
Ejemplo n.º 2
0
 public ActionResult Edit([Bind(Include = "id_collaboratortype,name,active,created_at,updated_at")] CollaboratorType collaboratorType)
 {
     if (ModelState.IsValid)
     {
         db.Entry(collaboratorType).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(collaboratorType));
 }
Ejemplo n.º 3
0
        public ActionResult Create([Bind(Include = "id_collaboratortype,name,active,created_at,updated_at")] CollaboratorType collaboratorType)
        {
            if (ModelState.IsValid)
            {
                db.CollaboratorTypes.Add(collaboratorType);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(collaboratorType));
        }
Ejemplo n.º 4
0
        // GET: CollaboratorType/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            CollaboratorType collaboratorType = db.CollaboratorTypes.Find(id);

            if (collaboratorType == null)
            {
                return(HttpNotFound());
            }
            return(View(collaboratorType));
        }
		public CreateResult CreateCollaborator(string applicationId, string email, CollaboratorType collaboratorType)
		{
			CheckArgumentNull("applicationId", applicationId);
			CheckArgumentNull("email", email);

			if (collaboratorType == CollaboratorType.None)
			{
				throw new ArgumentException("collaboratorType needs to be set.");
			}

			var request = new RestRequest(Method.POST);
			request.RequestFormat = DataFormat.Json;
			request.Resource = "applications/{applicationId}/collaborators";
			request.AddParameter("applicationId", applicationId, ParameterType.UrlSegment);
			request.AddBody(new
			{
				collaboratorEmail = email,
				role = GetCollaboratorType(collaboratorType),
			});
			return ExecuteCreate(request);
		}
        public CreateResult CreateCollaborator(string applicationSlug, string email, CollaboratorType collaboratorType)
        {
            CheckArgumentNull("applicationSlug", applicationSlug);
            CheckArgumentNull("email", email);

            if (collaboratorType == CollaboratorType.None)
            {
                throw new ArgumentException("collaboratorType needs to be set.");
            }

            var request = new RestRequest(Method.POST);

            request.RequestFormat = DataFormat.Json;
            request.Resource      = "applications/{applicationSlug}/collaborators";
            request.AddParameter("applicationSlug", applicationSlug, ParameterType.UrlSegment);
            request.AddBody(new
            {
                collaboratorEmail = email,
                role = GetCollaboratorType(collaboratorType),
            });
            return(ExecuteCreate(request));
        }
		public static string GetCollaboratorType(CollaboratorType collaboratorType)
		{
			var name = Enum.GetName(typeof(CollaboratorType), collaboratorType)
				.ToLower();
			return name;
		}